@@ -154,17 +154,21 @@ def test_posix_venv_scheme(self):
154
154
'python%d.%d' % sys .version_info [:2 ],
155
155
'site-packages' )
156
156
157
- # Resolve the paths in prefix
158
- binpath = os .path .join (sys . prefix , binpath )
159
- incpath = os .path .join (sys . prefix , incpath )
160
- libpath = os .path .join (sys . prefix , libpath )
157
+ # Resolve the paths in an imaginary venv/ directory
158
+ binpath = os .path .join ('venv' , binpath )
159
+ incpath = os .path .join ('venv' , incpath )
160
+ libpath = os .path .join ('venv' , libpath )
161
161
162
- self .assertEqual (binpath , sysconfig .get_path ('scripts' , scheme = 'posix_venv' ))
163
- self .assertEqual (libpath , sysconfig .get_path ('purelib' , scheme = 'posix_venv' ))
162
+ # Mimic the venv module, set all bases to the venv directory
163
+ bases = ('base' , 'platbase' , 'installed_base' , 'installed_platbase' )
164
+ vars = {base : 'venv' for base in bases }
165
+
166
+ self .assertEqual (binpath , sysconfig .get_path ('scripts' , scheme = 'posix_venv' , vars = vars ))
167
+ self .assertEqual (libpath , sysconfig .get_path ('purelib' , scheme = 'posix_venv' , vars = vars ))
164
168
165
169
# The include directory on POSIX isn't exactly the same as before,
166
170
# but it is "within"
167
- sysconfig_includedir = sysconfig .get_path ('include' , scheme = 'posix_venv' )
171
+ sysconfig_includedir = sysconfig .get_path ('include' , scheme = 'posix_venv' , vars = vars )
168
172
self .assertTrue (sysconfig_includedir .startswith (incpath + os .sep ))
169
173
170
174
def test_nt_venv_scheme (self ):
@@ -174,14 +178,19 @@ def test_nt_venv_scheme(self):
174
178
incpath = 'Include'
175
179
libpath = os .path .join ('Lib' , 'site-packages' )
176
180
177
- # Resolve the paths in prefix
178
- binpath = os .path .join (sys .prefix , binpath )
179
- incpath = os .path .join (sys .prefix , incpath )
180
- libpath = os .path .join (sys .prefix , libpath )
181
+ # Resolve the paths in an imaginary venv\ directory
182
+ venv = 'venv'
183
+ binpath = os .path .join (venv , binpath )
184
+ incpath = os .path .join (venv , incpath )
185
+ libpath = os .path .join (venv , libpath )
186
+
187
+ # Mimic the venv module, set all bases to the venv directory
188
+ bases = ('base' , 'platbase' , 'installed_base' , 'installed_platbase' )
189
+ vars = {base : 'venv' for base in bases }
181
190
182
- self .assertEqual (binpath , sysconfig .get_path ('scripts' , scheme = 'nt_venv' ))
183
- self .assertEqual (incpath , sysconfig .get_path ('include' , scheme = 'nt_venv' ))
184
- self .assertEqual (libpath , sysconfig .get_path ('purelib' , scheme = 'nt_venv' ))
191
+ self .assertEqual (binpath , sysconfig .get_path ('scripts' , scheme = 'nt_venv' , vars = vars ))
192
+ self .assertEqual (incpath , sysconfig .get_path ('include' , scheme = 'nt_venv' , vars = vars ))
193
+ self .assertEqual (libpath , sysconfig .get_path ('purelib' , scheme = 'nt_venv' , vars = vars ))
185
194
186
195
def test_venv_scheme (self ):
187
196
if sys .platform == 'win32' :
0 commit comments