Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3aa4418

Browse files
miss-islingtonartemmukhinhroncok
authored
[3.11]gh-103224: Resolve paths properly in test_sysconfig (GH-103292) (GH-115101)
To pass tests when executed through a Python symlink.(cherry picked from commit71239d5)Co-authored-by: Artem Mukhin <artem.m.mukhin@gmail.com>Co-authored-by: Miro Hrončok <miro@hroncok.cz>
1 parent6bc5316 commit3aa4418

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

‎Lib/test/test_sysconfig.py

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,21 @@ def test_posix_venv_scheme(self):
150150
'python%d.%d'%sys.version_info[:2],
151151
'site-packages')
152152

153-
# Resolve the paths inprefix
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 inan imaginary venv/ directory
154+
binpath=os.path.join('venv',binpath)
155+
incpath=os.path.join('venv',incpath)
156+
libpath=os.path.join('venv',libpath)
157157

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'forbaseinbases}
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))
160164

161165
# The include directory on POSIX isn't exactly the same as before,
162166
# 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)
164168
self.assertTrue(sysconfig_includedir.startswith(incpath+os.sep))
165169

166170
deftest_nt_venv_scheme(self):
@@ -170,14 +174,19 @@ def test_nt_venv_scheme(self):
170174
incpath='Include'
171175
libpath=os.path.join('Lib','site-packages')
172176

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'forbaseinbases}
177186

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))
181190

182191
deftest_venv_scheme(self):
183192
ifsys.platform=='win32':

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp