@@ -53,12 +53,12 @@ def test__no_namespace_packages__find_a_in_pkg1(self) -> None:
53
53
Find find pkg1/a.py for "a" with namespace_packages False.
54
54
"""
55
55
found_module = self .fmc_nons .find_module ("a" )
56
- expected = os .path .join (data_path , "pkg1" , "a.py" )
56
+ expected = os .path .abspath ( os . path . join (data_path , "pkg1" , "a.py" ) )
57
57
assert_equal (expected , found_module )
58
58
59
59
def test__no_namespace_packages__find_b_in_pkg2 (self ) -> None :
60
60
found_module = self .fmc_ns .find_module ("b" )
61
- expected = os .path .join (data_path , "pkg2" , "b" , "__init__.py" )
61
+ expected = os .path .abspath ( os . path . join (data_path , "pkg2" , "b" , "__init__.py" ) )
62
62
assert_equal (expected , found_module )
63
63
64
64
def test__find_nsx_as_namespace_pkg_in_pkg1 (self ) -> None :
@@ -67,39 +67,39 @@ def test__find_nsx_as_namespace_pkg_in_pkg1(self) -> None:
67
67
the path to the first one found in mypypath.
68
68
"""
69
69
found_module = self .fmc_ns .find_module ("nsx" )
70
- expected = os .path .join (data_path , "nsx-pkg1" , "nsx" )
70
+ expected = os .path .abspath ( os . path . join (data_path , "nsx-pkg1" , "nsx" ) )
71
71
assert_equal (expected , found_module )
72
72
73
73
def test__find_nsx_a_init_in_pkg1 (self ) -> None :
74
74
"""
75
75
Find nsx-pkg1/nsx/a/__init__.py for "nsx.a" in namespace mode.
76
76
"""
77
77
found_module = self .fmc_ns .find_module ("nsx.a" )
78
- expected = os .path .join (data_path , "nsx-pkg1" , "nsx" , "a" , "__init__.py" )
78
+ expected = os .path .abspath ( os . path . join (data_path , "nsx-pkg1" , "nsx" , "a" , "__init__.py" ) )
79
79
assert_equal (expected , found_module )
80
80
81
81
def test__find_nsx_b_init_in_pkg2 (self ) -> None :
82
82
"""
83
83
Find nsx-pkg2/nsx/b/__init__.py for "nsx.b" in namespace mode.
84
84
"""
85
85
found_module = self .fmc_ns .find_module ("nsx.b" )
86
- expected = os .path .join (data_path , "nsx-pkg2" , "nsx" , "b" , "__init__.py" )
86
+ expected = os .path .abspath ( os . path . join (data_path , "nsx-pkg2" , "nsx" , "b" , "__init__.py" ) )
87
87
assert_equal (expected , found_module )
88
88
89
89
def test__find_nsx_c_c_in_pkg3 (self ) -> None :
90
90
"""
91
91
Find nsx-pkg3/nsx/c/c.py for "nsx.c.c" in namespace mode.
92
92
"""
93
93
found_module = self .fmc_ns .find_module ("nsx.c.c" )
94
- expected = os .path .join (data_path , "nsx-pkg3" , "nsx" , "c" , "c.py" )
94
+ expected = os .path .abspath ( os . path . join (data_path , "nsx-pkg3" , "nsx" , "c" , "c.py" ) )
95
95
assert_equal (expected , found_module )
96
96
97
97
def test__find_nsy_a__init_pyi (self ) -> None :
98
98
"""
99
99
Prefer nsy-pkg1/a/__init__.pyi file over __init__.py.
100
100
"""
101
101
found_module = self .fmc_ns .find_module ("nsy.a" )
102
- expected = os .path .join (data_path , "nsy-pkg1" , "nsy" , "a" , "__init__.pyi" )
102
+ expected = os .path .abspath ( os . path . join (data_path , "nsy-pkg1" , "nsy" , "a" , "__init__.pyi" ) )
103
103
assert_equal (expected , found_module )
104
104
105
105
def test__find_nsy_b__init_py (self ) -> None :
@@ -109,7 +109,7 @@ def test__find_nsy_b__init_py(self) -> None:
109
109
a package is preferred over a module.
110
110
"""
111
111
found_module = self .fmc_ns .find_module ("nsy.b" )
112
- expected = os .path .join (data_path , "nsy-pkg2" , "nsy" , "b" , "__init__.py" )
112
+ expected = os .path .abspath ( os . path . join (data_path , "nsy-pkg2" , "nsy" , "b" , "__init__.py" ) )
113
113
assert_equal (expected , found_module )
114
114
115
115
def test__find_nsy_c_pyi (self ) -> None :
@@ -119,17 +119,17 @@ def test__find_nsy_c_pyi(self) -> None:
119
119
.pyi is preferred over .py.
120
120
"""
121
121
found_module = self .fmc_ns .find_module ("nsy.c" )
122
- expected = os .path .join (data_path , "nsy-pkg2" , "nsy" , "c.pyi" )
122
+ expected = os .path .abspath ( os . path . join (data_path , "nsy-pkg2" , "nsy" , "c.pyi" ) )
123
123
assert_equal (expected , found_module )
124
124
125
125
def test__find_a_in_pkg1 (self ) -> None :
126
126
found_module = self .fmc_ns .find_module ("a" )
127
- expected = os .path .join (data_path , "pkg1" , "a.py" )
127
+ expected = os .path .abspath ( os . path . join (data_path , "pkg1" , "a.py" ) )
128
128
assert_equal (expected , found_module )
129
129
130
130
def test__find_b_init_in_pkg2 (self ) -> None :
131
131
found_module = self .fmc_ns .find_module ("b" )
132
- expected = os .path .join (data_path , "pkg2" , "b" , "__init__.py" )
132
+ expected = os .path .abspath ( os . path . join (data_path , "pkg2" , "b" , "__init__.py" ) )
133
133
assert_equal (expected , found_module )
134
134
135
135
def test__find_d_nowhere (self ) -> None :
@@ -165,7 +165,7 @@ def setUp(self) -> None:
165
165
self .fmc_nons = FindModuleCache (self .search_paths , fscache = None , options = options )
166
166
167
167
def path (self , * parts : str ) -> str :
168
- return os .path .normpath (os .path .join (self .package_dir , * parts ))
168
+ return os .path .abspath (os .path .join (self .package_dir , * parts ))
169
169
170
170
def test__packages_with_ns (self ) -> None :
171
171
cases = [
@@ -214,7 +214,7 @@ def test__packages_with_ns(self) -> None:
214
214
# A regular package with an installed set of stubs
215
215
("foo.bar" , self .path ("foo-stubs" , "bar.pyi" )),
216
216
# A regular, non-site-packages module
217
- ("a" , os .path .join (data_path , "pkg1" , "a.py" )),
217
+ ("a" , os .path .abspath ( os . path . join (data_path , "pkg1" , "a.py" ) )),
218
218
]
219
219
for module , expected in cases :
220
220
template = "Find(" + module + ") got {}; expected {}"
@@ -269,7 +269,7 @@ def test__packages_without_ns(self) -> None:
269
269
# A regular package with an installed set of stubs
270
270
("foo.bar" , self .path ("foo-stubs" , "bar.pyi" )),
271
271
# A regular, non-site-packages module
272
- ("a" , os .path .join (data_path , "pkg1" , "a.py" )),
272
+ ("a" , os .path .abspath ( os . path . join (data_path , "pkg1" , "a.py" ) )),
273
273
]
274
274
for module , expected in cases :
275
275
template = "Find(" + module + ") got {}; expected {}"
0 commit comments