bpo-44860: Update test_sysconfig for posix_user platlib#28235
Conversation
Update test_sysconfig.test_user_similar() for the posix_user scheme: "platlib" doesn't use sys.platlibdir.
|
@uranusjr: Would you mind to review my change? |
| 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 | ||
| if name == 'platlib' and sys.platlibdir != 'lib': |
There was a problem hiding this comment.
What about this? The replacement can always happen.
| if name == 'platlib' and sys.platlibdir != 'lib': | |
| if name == 'platlib': |
There was a problem hiding this comment.
str.replace() is not reliabe, the full path may contain the /lib/ substring multiple times. Like /tmp/lib/runtests/lib/python3.9/. I prefer to only use it if it's really needed :-p
Or maybe we should use a more reliable replacement, like a regex?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I'm fine with removing the test: it was added 11 years ago by https://bugs.python.org/issue8759 sysconfig evolved a lot in the meanwhile, and the test became less relevant since sys.platlibdir was added to Python 3.9. But I don't know the sysconfig module. In case of doubt, I prefer to minimize changes. |
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
|
Sorry @vstinner, I had trouble checking out the |
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
|
GH-28251 is a backport of this pull request to the 3.10 branch. |
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 <vstinner@python.org>
Update test_sysconfig.test_user_similar() for the posix_user scheme:
"platlib" doesn't use sys.platlibdir.
https://bugs.python.org/issue44860