Skip to content

Commit 11103eb

Browse files
bpo-44860: Update test_sysconfig for posix_user platlib (GH-28235) (GH-28251)
Update test_sysconfig.test_user_similar() for the posix_user scheme: "platlib" doesn't use sys.platlibdir. (cherry picked from commit 49acac0) Co-authored-by: Victor Stinner <[email protected]>
1 parent c081866 commit 11103eb

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

Lib/test/pythoninfo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def collect_sys(info_add):
9696
'maxunicode',
9797
'path',
9898
'platform',
99+
'platlibdir',
99100
'prefix',
100101
'thread_info',
101102
'version',

Lib/test/test_sysconfig.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,17 @@ def test_user_similar(self):
296296
base = base.replace(sys.base_prefix, sys.prefix)
297297
if HAS_USER_BASE:
298298
user_path = get_path(name, 'posix_user')
299-
self.assertEqual(user_path, global_path.replace(base, user, 1))
299+
expected = global_path.replace(base, user, 1)
300+
# bpo-44860: platlib of posix_user doesn't use sys.platlibdir,
301+
# whereas posix_prefix does.
302+
if name == 'platlib':
303+
# Replace "/lib64/python3.11/site-packages" suffix
304+
# with "/lib/python3.11/site-packages".
305+
py_version_short = sysconfig.get_python_version()
306+
suffix = f'python{py_version_short}/site-packages'
307+
expected = expected.replace(f'/{sys.platlibdir}/{suffix}',
308+
f'/lib/{suffix}')
309+
self.assertEqual(user_path, expected)
300310

301311
def test_main(self):
302312
# just making sure _main() runs and returns things in the stdout
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Update ``test_sysconfig.test_user_similar()`` for the posix_user scheme:
2+
``platlib`` doesn't use :data:`sys.platlibdir`. Patch by Victor Stinner.

0 commit comments

Comments
 (0)