(
pytester: Pytester, monkeypatch: MonkeyPatch, path: str
)
| 392 | |
| 393 | @pytest.mark.parametrize("path", ["root", "{relative}/root", "{environment}/root"]) |
| 394 | def test_rootdir_option_arg( |
| 395 | pytester: Pytester, monkeypatch: MonkeyPatch, path: str |
| 396 | ) -> None: |
| 397 | monkeypatch.setenv("PY_ROOTDIR_PATH", str(pytester.path)) |
| 398 | path = path.format(relative=str(pytester.path), environment="$PY_ROOTDIR_PATH") |
| 399 | |
| 400 | rootdir = pytester.path / "root" / "tests" |
| 401 | rootdir.mkdir(parents=True) |
| 402 | pytester.makepyfile( |
| 403 | """ |
| 404 | import os |
| 405 | def test_one(): |
| 406 | assert 1 |
| 407 | """ |
| 408 | ) |
| 409 | |
| 410 | result = pytester.runpytest(f"--rootdir={path}") |
| 411 | result.stdout.fnmatch_lines( |
| 412 | [ |
| 413 | f"*rootdir: {pytester.path}/root", |
| 414 | "root/test_rootdir_option_arg.py *", |
| 415 | "*1 passed*", |
| 416 | ] |
| 417 | ) |
| 418 | |
| 419 | |
| 420 | def test_rootdir_wrong_option_arg(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected