Skip to content

Commit e7d5929

Browse files
committed
Add test to capture legacy expectation where distinfo might appear with a dot in the name.
1 parent dbdef6b commit e7d5929

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tests/fixtures.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,21 @@ def setUp(self):
119119
build_files(DistInfoPkgWithDot.files, self.site_dir)
120120

121121

122+
class DistInfoPkgWithDotLegacy(OnSysPath, SiteDir):
123+
files = {
124+
"pkg.dot-1.0.0.dist-info": {
125+
"METADATA": """
126+
Name: pkg.dot
127+
Version: 1.0.0
128+
""",
129+
},
130+
}
131+
132+
def setUp(self):
133+
super(DistInfoPkgWithDotLegacy, self).setUp()
134+
build_files(DistInfoPkgWithDotLegacy.files, self.site_dir)
135+
136+
122137
class DistInfoPkgOffPath(SiteDir):
123138
def setUp(self):
124139
super(DistInfoPkgOffPath, self).setUp()

tests/test_api.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ def test_more_complex_deps_requires_text(self):
163163
assert deps == expected
164164

165165

166+
class LegacyDots(fixtures.DistInfoPkgWithDotLegacy, unittest.TestCase):
167+
def test_name_normalization(self):
168+
names = 'pkg.dot', 'pkg_dot', 'pkg-dot', 'pkg..dot', 'Pkg.Dot'
169+
for name in names:
170+
with self.subTest(name):
171+
assert distribution(name).metadata['Name'] == 'pkg.dot'
172+
173+
166174
class OffSysPathTests(fixtures.DistInfoPkgOffPath, unittest.TestCase):
167175
def test_find_distributions_specified_path(self):
168176
dists = Distribution.discover(path=[str(self.site_dir)])

0 commit comments

Comments
 (0)