bpo-35617: Fix for unittest discover not working with implicit namespace packages#11364
bpo-35617: Fix for unittest discover not working with implicit namespace packages#11364simonfagerholm wants to merge 3 commits intopython:mainfrom
Conversation
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. You can check yourself to see if the CLA has been received. Thanks again for your contribution, we look forward to reviewing it! |
Lib/unittest/loader.py
Outdated
There was a problem hiding this comment.
I don't know if is convenient raise a Exception here. This can break other tests
Lib/unittest/loader.py
Outdated
|
any chance we can get this merged in for the next release? |
5481935 to
715a5d3
Compare
|
https://bugs.python.org/issue35617 is closed. What is the status of this PR? |
|
The issue bpo-35617 was closed as duplicated of https://bugs.python.org/issue23882. The last one, seems to be fixed and have severals PRs merged. IMO this PR should be closed. The last comment was from @terryjreedy, could you give us some clues here? |
|
This was superseded by #29745 so closing. |
If the startdir is considered a path, then the discover function does not look for implicit namespace packages. I fixed this.
Now if the startdir is not the topdir its checked for importability (if they are the same, then it should always be importable).
If the startdir does not contain a init.py file, then its considered a implicit namespace package.
To make sure that the directories are importable I changed the code so that ImportError is raised directly when problem is discovered instead of waiting.
The PR seems to fix the problem with this, but might affect other parts that I'm not aware of.
https://bugs.python.org/issue35617