(
pytester: Pytester, monkeypatch: MonkeyPatch, path: str
)
| 337 | |
| 338 | @pytest.mark.parametrize("path", ["root", "{relative}/root", "{environment}/root"]) |
| 339 | def test_rootdir_option_arg( |
| 340 | pytester: Pytester, monkeypatch: MonkeyPatch, path: str |
| 341 | ) -> None: |
| 342 | monkeypatch.setenv("PY_ROOTDIR_PATH", str(pytester.path)) |
| 343 | path = path.format(relative=str(pytester.path), environment="$PY_ROOTDIR_PATH") |
| 344 | |
| 345 | rootdir = pytester.path / "root" / "tests" |
| 346 | rootdir.mkdir(parents=True) |
| 347 | pytester.makepyfile( |
| 348 | """ |
| 349 | import os |
| 350 | def test_one(): |
| 351 | assert 1 |
| 352 | """ |
| 353 | ) |
| 354 | |
| 355 | result = pytester.runpytest(f"--rootdir={path}") |
| 356 | result.stdout.fnmatch_lines( |
| 357 | [ |
| 358 | f"*rootdir: {pytester.path}/root", |
| 359 | "root/test_rootdir_option_arg.py *", |
| 360 | "*1 passed*", |
| 361 | ] |
| 362 | ) |
| 363 | |
| 364 | |
| 365 | def test_rootdir_wrong_option_arg(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected