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