Skip to content

Commit fd0ea07

Browse files
committed
Fix - Fix test problem on Linux (#4088)
1 parent 2d71a42 commit fd0ea07

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Diff for: setuptools/command/easy_install.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@ def update_pth(self, dist): # noqa: C901 # is too complex (11) # FIXME
12561256

12571257
log.info("Removing %s from easy-install.pth file", d)
12581258
self.pth_file.remove(d)
1259-
if d_location in self.shadow_path:
1259+
if d_location in map(normalize_path, self.shadow_path):
12601260
self.shadow_path.remove(d_location)
12611261

12621262
if not self.multi_version:
@@ -1268,7 +1268,7 @@ def update_pth(self, dist): # noqa: C901 # is too complex (11) # FIXME
12681268
else:
12691269
log.info("Adding %s to easy-install.pth file", dist)
12701270
self.pth_file.add(dist) # add new entry
1271-
if dist_location not in self.shadow_path:
1271+
if dist_location not in map(normalize_path, self.shadow_path):
12721272
self.shadow_path.append(dist_location)
12731273

12741274
if self.dry_run:
@@ -1717,8 +1717,8 @@ def _wrap_lines(lines):
17171717
def add(self, dist):
17181718
"""Add `dist` to the distribution map"""
17191719
dist_location = normalize_path(dist.location)
1720-
new_path = dist_location not in self.paths and (
1721-
dist_location not in self.sitedirs
1720+
new_path = dist_location not in map(normalize_path, self.paths) and (
1721+
dist_location not in map(normalize_path, self.sitedirs)
17221722
or
17231723
# account for '.' being in PYTHONPATH
17241724
dist_location == normalize_path(os.getcwd())
@@ -1731,7 +1731,7 @@ def add(self, dist):
17311731
def remove(self, dist):
17321732
"""Remove `dist` from the distribution map"""
17331733
dist_location = normalize_path(dist.location)
1734-
while dist_location in self.paths:
1734+
while dist_location in map(normalize_path, self.paths):
17351735
self.paths.remove(dist_location)
17361736
self.dirty = True
17371737
super().remove(dist)

Diff for: setuptools/tests/test_easy_install.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,10 @@ def test_add_remove_for_normalized_path(self):
321321
In windows, path is not case sensitive,
322322
This is test when the distiribution path is cwd and normalized.
323323
"""
324-
path_org = 'C:/Location/package'
324+
if sys.platform.startswith('win'):
325+
path_org = 'C:/Location/package'
326+
else:
327+
path_org = '/Location/package'
325328
path_norm = pkg_resources.normalize_path(path_org)
326329

327330
pth = PthDistributions('test-package', [path_org])

0 commit comments

Comments
 (0)