Closed jaraco closed 1 year ago
I've managed to put together a test that captures the failure, but the test passes on 4.11.4, failing on 4.11.3 and earlier only:
importlib_metadata afdb973b3e $ git diff --cached
diff --git a/tests/test_main.py b/tests/test_main.py
index 215662dd04..8583146f2a 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -121,6 +121,23 @@ class NameNormalizationTests(fixtures.OnSysPath, fixtures.SiteDir, unittest.Test
assert len(after) == len(before)
+ def test_egg_and_dist_same(self):
+ """
+ Two distributions varying only by metadata style should resolve
+ as the same.
+ """
+ dist_info = {'storytime.dist-info': dict(METADATA='VERSION: 1.0\n')}
+ fixtures.build_files(dist_info, self.site_dir)
+ egg_info = {'storytime.egg-info': dict(METADATA='VERSION: 1.0\n')}
+ fixtures.build_files(egg_info, self.site_dir)
+ dists = [
+ dist
+ for dist in distributions()
+ if dist._normalized_name.startswith('storytime')
+ ]
+ assert len(dists) == 2
+ assert all(dist._normalized_name == 'storytime' for dist in dists)
+
Indeed, the issue is a duplicate of #377.
In https://github.com/jaraco/keyring/issues/526#issuecomment-1304167862, I learned that
_normalized_name
for.egg-info
distributions is resolving to<pkg>.egg
and thus is unique against the same package with.dist-info
, failing the expectation that entry points for a given package are loaded only once.