def test_simple_noini(self, tmpdir): assert get_common_ancestor([tmpdir]) == tmpdir a = tmpdir.mkdir("a") assert get_common_ancestor([a, tmpdir]) == tmpdir assert get_common_ancestor([tmpdir, a]) == tmpdir with tmpdir.as_cwd(): assert get_common_ancestor([]) == tmpdir no_path = tmpdir.join("does-not-exist") assert get_common_ancestor([no_path]) == tmpdir assert get_common_ancestor([no_path.join("a")]) == tmpdir
def test_simple_noini(self, tmpdir): assert get_common_ancestor([tmpdir]) == tmpdir a = tmpdir.mkdir("a") assert get_common_ancestor([a, tmpdir]) == tmpdir assert get_common_ancestor([tmpdir, a]) == tmpdir with tmpdir.as_cwd(): assert get_common_ancestor([]) == tmpdir no_path = tmpdir.join("does-not-exist") assert get_common_ancestor([no_path]) == tmpdir assert get_common_ancestor([no_path.join("a")]) == tmpdir
def test_single_file(self, tmp_path: Path) -> None: fn = tmp_path / "foo.py" fn.touch() assert get_common_ancestor([fn]) == tmp_path
def test_single_dir(self, tmp_path: Path) -> None: assert get_common_ancestor([tmp_path]) == tmp_path
def test_single_file(self, tmpdir): fn = tmpdir.join("foo.py").ensure(file=1) assert get_common_ancestor([fn]) == tmpdir
def test_single_dir(self, tmpdir): assert get_common_ancestor([tmpdir]) == tmpdir