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

Function test_collect_pyargs_with_testpaths

testing/test_collection.py:1178–1199  ·  view source on GitHub ↗
(
    pytester: Pytester, monkeypatch: MonkeyPatch
)

Source from the content-addressed store, hash-verified

1176
1177
1178def test_collect_pyargs_with_testpaths(
1179 pytester: Pytester, monkeypatch: MonkeyPatch
1180) -> None:
1181 testmod = pytester.mkdir("testmod")
1182 # NOTE: __init__.py is not collected since it does not match python_files.
1183 testmod.joinpath("__init__.py").write_text("def test_func(): pass")
1184 testmod.joinpath("test_file.py").write_text("def test_func(): pass")
1185
1186 root = pytester.mkdir("root")
1187 root.joinpath("pytest.ini").write_text(
1188 textwrap.dedent(
1189 """
1190 [pytest]
1191 addopts = --pyargs
1192 testpaths = testmod
1193 """
1194 )
1195 )
1196 monkeypatch.setenv("PYTHONPATH", str(pytester.path), prepend=os.pathsep)
1197 with root.cwd():
1198 result = pytester.runpytest_subprocess()
1199 result.stdout.fnmatch_lines(["*1 passed in*"])
1200
1201
1202def test_collect_symlink_file_arg(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 4

setenvMethod · 0.80
fnmatch_linesMethod · 0.80
mkdirMethod · 0.45
runpytest_subprocessMethod · 0.45

Tested by

no test coverage detected