MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_exit_on_collection_error

Function test_exit_on_collection_error

testing/test_collection.py:907–922  ·  view source on GitHub ↗

Verify that all collection errors are collected and no tests executed

(pytester: Pytester)

Source from the content-addressed store, hash-verified

905
906
907def test_exit_on_collection_error(pytester: Pytester) -> None:
908 """Verify that all collection errors are collected and no tests executed"""
909 pytester.makepyfile(**COLLECTION_ERROR_PY_FILES)
910
911 res = pytester.runpytest()
912 assert res.ret == 2
913
914 res.stdout.fnmatch_lines(
915 [
916 "collected 2 items / 2 errors",
917 "*ERROR collecting test_02_import_error.py*",
918 "*No module named *asdfa*",
919 "*ERROR collecting test_03_import_error.py*",
920 "*No module named *asdfa*",
921 ]
922 )
923
924
925def test_exit_on_collection_with_maxfail_smaller_than_n_errors(

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected