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

Method test_packages

testing/test_cacheprovider.py:1026–1054  ·  view source on GitHub ↗

Regression test for #7758. The particular issue here was that Package nodes were included in the filtering, being themselves Modules for the __init__.py, even if they had failed Modules in them. The tests includes a test in an __init__.py file just to make sure the

(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

1024 assert result.ret == 0
1025
1026 def test_packages(self, pytester: Pytester) -> None:
1027 """Regression test for #7758.
1028
1029 The particular issue here was that Package nodes were included in the
1030 filtering, being themselves Modules for the __init__.py, even if they
1031 had failed Modules in them.
1032
1033 The tests includes a test in an __init__.py file just to make sure the
1034 fix doesn't somehow regress that, it is not critical for the issue.
1035 """
1036 pytester.makepyfile(
1037 **{
1038 "__init__.py": "",
1039 "a/__init__.py": "def test_a_init(): assert False",
1040 "a/test_one.py": "def test_1(): assert False",
1041 "b/__init__.py": "",
1042 "b/test_two.py": "def test_2(): assert False",
1043 },
1044 )
1045 pytester.makeini(
1046 """
1047 [pytest]
1048 python_files = *.py
1049 """
1050 )
1051 result = pytester.runpytest()
1052 result.assert_outcomes(failed=3)
1053 result = pytester.runpytest("--lf")
1054 result.assert_outcomes(failed=3)
1055
1056
1057class TestNewFirst:

Callers

nothing calls this directly

Calls 4

assert_outcomesMethod · 0.80
makepyfileMethod · 0.45
makeiniMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected