mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Fix transform_path_to_dotted tests on Windows
Convert paths to normalized absolute ones in transform_path_to_dotted tests.
This commit is contained in:
@@ -200,7 +200,8 @@ def transform_path_to_dotted(sys_path, module_path):
|
|||||||
"""
|
"""
|
||||||
Returns the dotted path inside a sys.path as a list of names. e.g.
|
Returns the dotted path inside a sys.path as a list of names. e.g.
|
||||||
|
|
||||||
>>> transform_path_to_dotted(["/foo"], '/foo/bar/baz.py')
|
>>> from os.path import abspath
|
||||||
|
>>> transform_path_to_dotted([abspath("/foo")], abspath('/foo/bar/baz.py'))
|
||||||
['bar', 'baz']
|
['bar', 'baz']
|
||||||
|
|
||||||
Returns None if the path doesn't really resolve to anything.
|
Returns None if the path doesn't really resolve to anything.
|
||||||
|
|||||||
@@ -86,4 +86,7 @@ _s = ['/a', '/b', '/c/d/']
|
|||||||
(_s, '/a/c/.py', None),
|
(_s, '/a/c/.py', None),
|
||||||
])
|
])
|
||||||
def test_calculate_dotted_from_path(sys_path_, module_path, result):
|
def test_calculate_dotted_from_path(sys_path_, module_path, result):
|
||||||
|
# tranform_path_to_dotted expects normalized absolute paths.
|
||||||
|
sys_path_ = [os.path.abspath(path) for path in sys_path_]
|
||||||
|
module_path = os.path.abspath(module_path)
|
||||||
assert sys_path.transform_path_to_dotted(sys_path_, module_path) == result
|
assert sys_path.transform_path_to_dotted(sys_path_, module_path) == result
|
||||||
|
|||||||
Reference in New Issue
Block a user