@@ -462,21 +462,24 @@ def fake_site_packages(self, tmp_path, monkeypatch, dist_files):
462
462
}
463
463
464
464
@pytest .mark .parametrize (
465
- ("name" , " version" , "req " ),
465
+ ("version" , "requirement " ),
466
466
[
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" ),
471
471
],
472
472
)
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
+ ):
474
476
# https://github.com/pypa/setuptools/issues/4853
475
477
site_packages = self .fake_site_packages (tmp_path , monkeypatch , self .FILES )
476
478
ws = pkg_resources .WorkingSet ([site_packages ])
477
479
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