-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-44860: Update test_sysconfig for posix_user platlib #28235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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? |
Lib/test/test_sysconfig.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the failure for Fedora. Not sure if this test is worth keeping, but that's a question that is out of scope here.
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 <[email protected]>
…H-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]>
…H-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]>
Update test_sysconfig.test_user_similar() for the posix_user scheme:
"platlib" doesn't use sys.platlibdir.
https://bugs.python.org/issue44860