Skip to content

Commit 22355fc

Browse files
committed
Also consider '-' separator in tests
1 parent 8280e2c commit 22355fc

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

pkg_resources/tests/test_pkg_resources.py

+14-11
Original file line numberDiff line numberDiff line change
@@ -462,21 +462,24 @@ def fake_site_packages(self, tmp_path, monkeypatch, dist_files):
462462
}
463463

464464
@pytest.mark.parametrize(
465-
("name", "version", "req"),
465+
("version", "requirement"),
466466
[
467-
("pkg1.mod", "1.2.3", "pkg1.mod>=1"),
468-
("pkg2.mod", "0.42", "pkg2.mod>=0.4"),
469-
("pkg3.mod", "1.2.3.4", "pkg3.mod<=2"),
470-
("pkg4.mod", "0.42.1", "pkg4.mod>0.2,<1"),
467+
("1.2.3", "pkg1.mod>=1"),
468+
("0.42", "pkg2.mod>=0.4"),
469+
("1.2.3.4", "pkg3.mod<=2"),
470+
("0.42.1", "pkg4.mod>0.2,<1"),
471471
],
472472
)
473-
def test_require_normalised_name(self, tmp_path, monkeypatch, name, version, req):
473+
def test_require_non_normalised_name(
474+
self, tmp_path, monkeypatch, version, requirement
475+
):
474476
# https://github.com/pypa/setuptools/issues/4853
475477
site_packages = self.fake_site_packages(tmp_path, monkeypatch, self.FILES)
476478
ws = pkg_resources.WorkingSet([site_packages])
477479

478-
[dist] = ws.require(req)
479-
assert dist.version == version
480-
assert os.path.samefile(
481-
os.path.commonpath([dist.location, site_packages]), site_packages
482-
)
480+
for req in [requirement, requirement.replace(".", "-")]:
481+
[dist] = ws.require(req)
482+
assert dist.version == version
483+
assert os.path.samefile(
484+
os.path.commonpath([dist.location, site_packages]), site_packages
485+
)

0 commit comments

Comments
 (0)