Commit 6966c759 authored by Jason R. Coombs's avatar Jason R. Coombs

Extract patch and its purpose into a specialized function which can be excluded from coverage.

parent 9af3f420
...@@ -2220,15 +2220,18 @@ register_namespace_handler(object, null_ns_handler) ...@@ -2220,15 +2220,18 @@ register_namespace_handler(object, null_ns_handler)
def normalize_path(filename): def normalize_path(filename):
"""Normalize a file/dir name for comparison purposes""" """Normalize a file/dir name for comparison purposes"""
if sys.platform == 'cygwin': return os.path.normcase(os.path.realpath(_cygwin_patch(filename)))
# This results in a call to getcwd() if `filename` is relative. Contrary
# to POSIX 2008 on Cygwin getcwd (3) contains symlink components. Using
# os.path.abspath() works around this limitation. A fix in os.getcwd() def _cygwin_patch(filename): # pragma: nocover
# would probably better, in Cygwin even more so except that this seems """
# to be by design... Contrary to POSIX 2008, on Cygwin, getcwd (3) contains
return os.path.normcase(os.path.realpath(os.path.abspath(filename))) symlink components. Using
else: os.path.abspath() works around this limitation. A fix in os.getcwd()
return os.path.normcase(os.path.realpath(filename)) would probably better, in Cygwin even more so, except
that this seems to be by design...
"""
return os.path.abspath(filename) if sys.platform == 'cygwin' else filename
def _normalize_cached(filename, _cache={}): def _normalize_cached(filename, _cache={}):
......
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