@pytest.mark.parametrize('verbose', [True, False])
def test_color_yes_collection_on_non_atty(testdir, verbose):
 testdir.makepyfile("\n        import pytest\n        @pytest.mark.parametrize('i', range(10))\n        def test_this(i):\n            assert 1\n    ")
 args = ['--color=yes']
 if verbose:
  args.append('-vv')
 result = testdir.runpytest(*args)
 assert ('test session starts' in result.stdout.str())
 assert ('\x1b[1m' in result.stdout.str())
 assert ('collecting 10 items' not in result.stdout.str())
 if verbose:
  assert ('collecting ...' in result.stdout.str())
 assert ('collected 10 items' in result.stdout.str())

@ pytest . mark . parametrize ( 'verbose' , [ True , False ] ) def test_color_yes_collection_on_non_atty ( testdir , verbose ) : testdir . makepyfile ( "\n        import pytest\n        @pytest.mark.parametrize('i', range(10))\n        def test_this(i):\n            assert 1\n    " ) args = [ '--color=yes' ] if verbose : args . append ( '-vv' ) result = testdir . runpytest ( * args ) assert ( 'test session starts' in result . stdout . str ( ) ) assert ( '\x1b[1m' in result . stdout . str ( ) ) assert ( 'collecting 10 items' not in result . stdout . str ( ) ) if verbose : assert ( 'collecting ...' in result . stdout . str ( ) ) assert ( 'collected 10 items' in result . stdout . str ( ) )
skip collect progress report when working on non-terminals .