Skip to content

Commit

Permalink
add more unit tests and fix small typo
Browse files Browse the repository at this point in the history
  • Loading branch information
rgildein committed Jan 12, 2024
1 parent c3fc03e commit 7b9678b
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions tests/unit/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See LICENSE file for licensing details.

import unittest
from pathlib import Path
from pathlib import Path, PosixPath
from unittest.mock import MagicMock, call, patch
from uuid import uuid4

Expand Down Expand Up @@ -100,7 +100,27 @@ def test_get_package_indices(tmp_path, paths, exp_indices):
_path.mkdir(parents=True, exist_ok=True)
_path.touch()

assert utils._get_package_indices(dists) == [dists / indice for indice in exp_indices]
assert utils._get_package_indices(dists) == [dists / index for index in exp_indices]


def test_get_archive_root_symlink():
"""Test helper function to get root for pool."""
mock_path = MagicMock(spec_set=Path)
pool = mock_path("/a/b/c")
pool.is_symlink.return_value = True

archive_root = utils._get_archive_root(pool)
assert archive_root == pool.resolve.return_value.parent.absolute.return_value


def test_get_archive_root():
"""Test helper function to get root for pool."""
mock_path = MagicMock(spec_set=Path)
pool = mock_path("/a/b/c")
pool.is_symlink.return_value = False

archive_root = utils._get_archive_root(pool)
assert archive_root == pool.parent.absolute.return_value


class TestUtils(unittest.TestCase):
Expand Down

0 comments on commit 7b9678b

Please sign in to comment.