Commit 84f1abaf authored by Tzu-ping Chung's avatar Tzu-ping Chung

Call os.path.normpath to normalize paths for comp

parent 8c22c3b5
Perform additional path normalization to ensure path values to a directory is always the same, preventing false positives when checking scripts have a consistent prefix to set up on Windows.
......@@ -2228,7 +2228,7 @@ register_namespace_handler(object, null_ns_handler)
def normalize_path(filename):
"""Normalize a file/dir name for comparison purposes"""
return os.path.normcase(os.path.realpath(filename))
return os.path.normcase(os.path.normpath(os.path.realpath(filename)))
def _normalize_cached(filename, _cache={}):
......
......@@ -236,3 +236,8 @@ class TestDeepVersionLookupDistutils:
req = pkg_resources.Requirement.parse('foo>=1.9')
dist = pkg_resources.WorkingSet([env.paths['lib']]).find(req)
assert dist.version == version
def test_normalize_path(self, tmpdir):
path = str(tmpdir)
expected = os.path.normcase(os.path.normpath(os.path.realpath(path)))
assert pkg_resources.normalize_path(path) == expected
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment