Skip to content

Commit da98092

Browse files
committed
Add test for _unique.
1 parent a3ad5f7 commit da98092

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_main.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
EntryPoint,
1414
MetadataPathFinder,
1515
PackageNotFoundError,
16+
_unique,
1617
distributions,
1718
entry_points,
1819
metadata,
@@ -105,6 +106,21 @@ def test_dist_name_found_as_any_case(self):
105106
assert version(pkg_name.lower()) == '1.0'
106107
assert version(pkg_name.upper()) == '1.0'
107108

109+
def test_unique_distributions(self):
110+
"""
111+
Two distributions varying only by non-normalized name on
112+
the file system should resolve as the same.
113+
"""
114+
fixtures.build_files(self.make_pkg('abc'), self.site_dir)
115+
before = list(_unique(distributions()))
116+
117+
alt_site_dir = self.fixtures.enter_context(fixtures.tempdir())
118+
self.fixtures.enter_context(self.add_sys_path(alt_site_dir))
119+
fixtures.build_files(self.make_pkg('ABC'), alt_site_dir)
120+
after = list(_unique(distributions()))
121+
122+
assert len(after) == len(before)
123+
108124

109125
class NonASCIITests(fixtures.OnSysPath, fixtures.SiteDir, unittest.TestCase):
110126
@staticmethod

0 commit comments

Comments
 (0)