@@ -149,17 +149,21 @@ def test_posix_venv_scheme(self):
149149 'python%d.%d' % sys .version_info [:2 ],
150150 'site-packages' )
151151
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 )
156156
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 ))
159163
160164 # The include directory on POSIX isn't exactly the same as before,
161165 # 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 )
163167 self .assertTrue (sysconfig_includedir .startswith (incpath + os .sep ))
164168
165169 def test_nt_venv_scheme (self ):
@@ -169,14 +173,19 @@ def test_nt_venv_scheme(self):
169173 incpath = 'Include'
170174 libpath = os .path .join ('Lib' , 'site-packages' )
171175
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 }
176185
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 ))
180189
181190 def test_venv_scheme (self ):
182191 if sys .platform == 'win32' :
0 commit comments