(
pytester: Pytester, monkeypatch: MonkeyPatch
)
| 1176 | |
| 1177 | |
| 1178 | def 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 | |
| 1202 | def test_collect_symlink_file_arg(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected