def test_exit_on_collection_error(testdir):
 testdir.makepyfile(**COLLECTION_ERROR_PY_FILES)
 res = testdir.runpytest()
 assert (res.ret == 2)
 res.stdout.fnmatch_lines(['collected 2 items / 2 errors', '*ERROR collecting test_02_import_error.py*', '*No module named *asdfa*', '*ERROR collecting test_03_import_error.py*', '*No module named *asdfa*'])

def test_exit_on_collection_error ( testdir ) : testdir . makepyfile ( ** COLLECTION_ERROR_PY_FILES ) res = testdir . runpytest ( ) assert ( res . ret == 2 ) res . stdout . fnmatch_lines ( [ 'collected 2 items / 2 errors' , '*ERROR collecting test_02_import_error.py*' , '*No module named *asdfa*' , '*ERROR collecting test_03_import_error.py*' , '*No module named *asdfa*' ] )
verify that all collection errors are collected and no tests executed .