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

Function test_continue_on_collection_errors_maxfail

testing/test_collection.py:987–1000  ·  view source on GitHub ↗

Verify tests are executed even when collection errors occur and that maxfail is honoured (including the collection error count). 4 tests: 2 collection errors + 1 failure + 1 success test_4 is never executed because the test run is with --maxfail=3 which means it is interrupted a

(pytester: Pytester)

Source from the content-addressed store, hash-verified

985
986
987def test_continue_on_collection_errors_maxfail(pytester: Pytester) -> None:
988 """
989 Verify tests are executed even when collection errors occur and that maxfail
990 is honoured (including the collection error count).
991 4 tests: 2 collection errors + 1 failure + 1 success
992 test_4 is never executed because the test run is with --maxfail=3 which
993 means it is interrupted after the 2 collection errors + 1 failure.
994 """
995 pytester.makepyfile(**COLLECTION_ERROR_PY_FILES)
996
997 res = pytester.runpytest("--continue-on-collection-errors", "--maxfail=3")
998 assert res.ret == 1
999
1000 res.stdout.fnmatch_lines(["collected 2 items / 2 errors", "*1 failed, 2 errors*"])
1001
1002
1003def test_fixture_scope_sibling_conftests(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected