Ensure that it handles dirs, and does not always use dirname.
()
| 114 | |
| 115 | |
| 116 | def test__check_initialpaths_for_relpath() -> None: |
| 117 | """Ensure that it handles dirs, and does not always use dirname.""" |
| 118 | cwd = Path.cwd() |
| 119 | |
| 120 | class FakeSession1: |
| 121 | _initialpaths = frozenset({cwd}) |
| 122 | |
| 123 | session = cast(pytest.Session, FakeSession1) |
| 124 | |
| 125 | assert nodes._check_initialpaths_for_relpath(session, cwd) == "" |
| 126 | |
| 127 | sub = cwd / "file" |
| 128 | |
| 129 | class FakeSession2: |
| 130 | _initialpaths = frozenset({cwd}) |
| 131 | |
| 132 | session = cast(pytest.Session, FakeSession2) |
| 133 | |
| 134 | assert nodes._check_initialpaths_for_relpath(session, sub) == "file" |
| 135 | |
| 136 | outside = Path("/outside-this-does-not-exist") |
| 137 | assert nodes._check_initialpaths_for_relpath(session, outside) is None |
| 138 | |
| 139 | |
| 140 | def test_failure_with_changed_cwd(pytester: Pytester) -> None: |
nothing calls this directly
no outgoing calls
no test coverage detected