Skip to content

Commit

Permalink
Add test for _unique.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed May 21, 2022
1 parent a3ad5f7 commit da98092
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
EntryPoint,
MetadataPathFinder,
PackageNotFoundError,
_unique,
distributions,
entry_points,
metadata,
Expand Down Expand Up @@ -105,6 +106,21 @@ def test_dist_name_found_as_any_case(self):
assert version(pkg_name.lower()) == '1.0'
assert version(pkg_name.upper()) == '1.0'

def test_unique_distributions(self):
"""
Two distributions varying only by non-normalized name on
the file system should resolve as the same.
"""
fixtures.build_files(self.make_pkg('abc'), self.site_dir)
before = list(_unique(distributions()))

alt_site_dir = self.fixtures.enter_context(fixtures.tempdir())
self.fixtures.enter_context(self.add_sys_path(alt_site_dir))
fixtures.build_files(self.make_pkg('ABC'), alt_site_dir)
after = list(_unique(distributions()))

assert len(after) == len(before)


class NonASCIITests(fixtures.OnSysPath, fixtures.SiteDir, unittest.TestCase):
@staticmethod
Expand Down

0 comments on commit da98092

Please sign in to comment.