-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
bpo-46421: Fix unittest filename evaluation when called as a module #30654
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
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
I guess we'll wait the few business days.. :) |
This is a better solution to the unittest fix that passes its own unit tests. Instead of filtering for ``None`` types, I just tear off the first dots in ``name``
The latest commit fixes the pipelines. |
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.
LGTM but a test would be required here. See https://devguide.python.org/runtests/
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be poked with soft cushions! |
I have made the requested changes; please review again. |
Thanks for making the requested changes! @JelleZijlstra: please review the changes made to this pull request. |
Good thing I read the contribution docs. I was about to |
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.
Thanks! Going to try this out myself later today and then hopefully merge it.
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.
Tried it locally and it works great!
I noticed it also fixes invocations like ./python.exe -m unittest Lib/test/../test/test_longexp.py
. We could add a test for that, but it's not particularly useful so I won't insist on it.
I'll merge this in the next few days and backport to 3.9 and 3.10.
(MacOS CI is failing, but it looks unrelated to this change and didn't reproduce locally on my Mac.) |
Thanks @BaderSZ for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10. |
GH-31969 is a backport of this pull request to the 3.10 branch. |
GH-31970 is a backport of this pull request to the 3.9 branch. |
…ythonGH-30654) (cherry picked from commit a0db11b) Co-authored-by: Bader Zaidan <bader@zaidan.pw>
…ythonGH-30654) (cherry picked from commit a0db11b) Co-authored-by: Bader Zaidan <bader@zaidan.pw>
…dule (pythonGH-30654) (pythonGH-31970) (cherry picked from commit a0db11b) Co-authored-by: Bader Zaidan <bader@zaidan.pw>
See issue: https://bugs.python.org/issue46421
I stumbled across this issue when writing my own tests. I tried to run the tests as
python -m unittest ./tests/*.py
but failed. This surprisingly worked later when I removed the./
from the beginning of the filename/directory.Some investigation showed that the variable
parts
in Lib/unittest/loader.py:125 had a'.'
in the beginning. Removing that fixed the issue.https://bugs.python.org/issue46421