(self, tmp_path: Path)
| 171 | |
| 172 | class TestCommonAncestor: |
| 173 | def test_has_ancestor(self, tmp_path: Path) -> None: |
| 174 | fn1 = tmp_path / "foo" / "bar" / "test_1.py" |
| 175 | fn1.parent.mkdir(parents=True) |
| 176 | fn1.touch() |
| 177 | fn2 = tmp_path / "foo" / "zaz" / "test_2.py" |
| 178 | fn2.parent.mkdir(parents=True) |
| 179 | fn2.touch() |
| 180 | cwd = Path.cwd() |
| 181 | assert get_common_ancestor(cwd, [fn1, fn2]) == tmp_path / "foo" |
| 182 | assert get_common_ancestor(cwd, [fn1.parent, fn2]) == tmp_path / "foo" |
| 183 | assert get_common_ancestor(cwd, [fn1.parent, fn2.parent]) == tmp_path / "foo" |
| 184 | assert get_common_ancestor(cwd, [fn1, fn2.parent]) == tmp_path / "foo" |
| 185 | |
| 186 | def test_single_dir(self, tmp_path: Path) -> None: |
| 187 | assert get_common_ancestor(Path.cwd(), [tmp_path]) == tmp_path |
nothing calls this directly
no test coverage detected