diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-09-09 02:35:36 -0700 |
|---|---|---|
| committer | Pablo Galindo <pablogsal@gmail.com> | 2021-09-29 12:37:59 +0100 |
| commit | 01be51833db23414b5dc766f9c92953d838d82c3 (patch) | |
| tree | 28a80f600fe93b02d48ea01c5bd9cc8392314a0e | |
| parent | 6ae97bbf4e6540a8287c47d098cfe703260b5fa2 (diff) | |
| download | cpython-git-01be51833db23414b5dc766f9c92953d838d82c3.tar.gz | |
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 49acac00c08838d8080ce00d02c05284b94f8fb2)
Co-authored-by: Victor Stinner <vstinner@python.org>
| -rw-r--r-- | Lib/test/pythoninfo.py | 1 | ||||
| -rw-r--r-- | Lib/test/test_sysconfig.py | 12 | ||||
| -rw-r--r-- | Misc/NEWS.d/next/Tests/2021-09-08-13-01-37.bpo-44860.qXd0kx.rst | 2 |
3 files changed, 14 insertions, 1 deletions
diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py index 278dfe7f7d..39ee9e1d76 100644 --- a/Lib/test/pythoninfo.py +++ b/Lib/test/pythoninfo.py @@ -96,6 +96,7 @@ def collect_sys(info_add): 'maxunicode', 'path', 'platform', + 'platlibdir', 'prefix', 'thread_info', 'version', diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index b8b9add36d..9408657c91 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -296,7 +296,17 @@ class TestSysConfig(unittest.TestCase): base = base.replace(sys.base_prefix, sys.prefix) if HAS_USER_BASE: user_path = get_path(name, 'posix_user') - self.assertEqual(user_path, global_path.replace(base, user, 1)) + expected = global_path.replace(base, user, 1) + # bpo-44860: platlib of posix_user doesn't use sys.platlibdir, + # whereas posix_prefix does. + if name == 'platlib': + # Replace "/lib64/python3.11/site-packages" suffix + # with "/lib/python3.11/site-packages". + py_version_short = sysconfig.get_python_version() + suffix = f'python{py_version_short}/site-packages' + expected = expected.replace(f'/{sys.platlibdir}/{suffix}', + f'/lib/{suffix}') + self.assertEqual(user_path, expected) def test_main(self): # just making sure _main() runs and returns things in the stdout diff --git a/Misc/NEWS.d/next/Tests/2021-09-08-13-01-37.bpo-44860.qXd0kx.rst b/Misc/NEWS.d/next/Tests/2021-09-08-13-01-37.bpo-44860.qXd0kx.rst new file mode 100644 index 0000000000..153a9c5573 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2021-09-08-13-01-37.bpo-44860.qXd0kx.rst @@ -0,0 +1,2 @@ +Update ``test_sysconfig.test_user_similar()`` for the posix_user scheme: +``platlib`` doesn't use :data:`sys.platlibdir`. Patch by Victor Stinner. |
