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

Method test_ignore_collect_path

testing/test_collection.py:340–354  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

338
339class TestCustomConftests:
340 def test_ignore_collect_path(self, pytester: Pytester) -> None:
341 pytester.makeconftest(
342 """
343 def pytest_ignore_collect(collection_path, config):
344 return collection_path.name.startswith("x") or collection_path.name == "test_one.py"
345 """
346 )
347 sub = pytester.mkdir("xy123")
348 ensure_file(sub / "test_hello.py").write_text("syntax error")
349 sub.joinpath("conftest.py").write_text("syntax error")
350 pytester.makepyfile("def test_hello(): pass")
351 pytester.makepyfile(test_one="syntax error")
352 result = pytester.runpytest("--fulltrace")
353 assert result.ret == 0
354 result.stdout.fnmatch_lines(["*1 passed*"])
355
356 def test_ignore_collect_not_called_on_argument(self, pytester: Pytester) -> None:
357 pytester.makeconftest(

Callers

nothing calls this directly

Calls 6

ensure_fileFunction · 0.85
fnmatch_linesMethod · 0.80
makeconftestMethod · 0.45
mkdirMethod · 0.45
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected