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