Esempio n. 1
0
 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
Esempio n. 2
0
 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
Esempio n. 3
0
 def test_single_file(self, tmp_path: Path) -> None:
     fn = tmp_path / "foo.py"
     fn.touch()
     assert get_common_ancestor([fn]) == tmp_path
Esempio n. 4
0
 def test_single_dir(self, tmp_path: Path) -> None:
     assert get_common_ancestor([tmp_path]) == tmp_path
Esempio n. 5
0
 def test_single_file(self, tmpdir):
     fn = tmpdir.join("foo.py").ensure(file=1)
     assert get_common_ancestor([fn]) == tmpdir
Esempio n. 6
0
 def test_single_dir(self, tmpdir):
     assert get_common_ancestor([tmpdir]) == tmpdir