MCPcopy
hub / github.com/pytest-dev/pytest / test_ignore_collect_path

Method test_ignore_collect_path

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

Source from the content-addressed store, hash-verified

368
369class TestCustomConftests:
370 def test_ignore_collect_path(self, pytester: Pytester) -> None:
371 pytester.makeconftest(
372 """
373 def pytest_ignore_collect(collection_path, config):
374 return collection_path.name.startswith("x") or collection_path.name == "test_one.py"
375 """
376 )
377 sub = pytester.mkdir("xy123")
378 ensure_file(sub / "test_hello.py").write_text("syntax error", encoding="utf-8")
379 sub.joinpath("conftest.py").write_text("syntax error", encoding="utf-8")
380 pytester.makepyfile("def test_hello(): pass")
381 pytester.makepyfile(test_one="syntax error")
382 result = pytester.runpytest("--fulltrace")
383 assert result.ret == 0
384 result.stdout.fnmatch_lines(["*1 passed*"])
385
386 def test_ignore_collect_not_called_on_argument(self, pytester: Pytester) -> None:
387 pytester.makeconftest(

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected