Skip to content

Commit

Permalink
Add test_prefix_files
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard committed Mar 27, 2024
1 parent 9267dae commit 1497cad
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,3 +433,19 @@ def test_is_conda_pkg(tmpdir, value: str, expected: bool, is_dir: bool, create:
fp.write("test")

assert utils.is_conda_pkg(value) == expected


def test_prefix_files(tmp_path: Path):
(prefix := tmp_path / "prefix1").mkdir()
(dirA := prefix / "dirA").mkdir()
(dirB := prefix / "dirB").mkdir()
(file1 := dirA / "file1").touch()
(file2 := dirB / "file2").touch()

(prefix2 := tmp_path / "prefix2").mkdir()
(dirC := prefix2 / "dirC").mkdir()
(link1 := prefix / "dirC").symlink_to(dirC)
(link1 / "file3").touch()

paths = {str(path.relative_to(prefix)) for path in (file1, file2, link1)}
assert paths == utils.prefix_files(str(prefix))

0 comments on commit 1497cad

Please sign in to comment.