-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
--import-mode=importlib breaks assertion rewriting #12044
Comments
Ok I was missing that after turning importlib back on, the issue returns, so in fact rewriting fails when importlib is turned on. |
We need to verify what's up here I suspect we are missing a bit where import lib will correctly fail for invalid module names, thus the assertions rewriter does as well, and then we incorrectly fall back to normal module loading Most likely we try to find a test module inside a folder after not doing a sanity check on the filename, after that fails the normal import lib machinery takes over finding the module by path and working I won't be able to verify before next week myself |
I am having this issue as well. It seems that it only happens if I have my tests in a package:
If I remove |
I've had the same issue, the fix from @estyrke works, the test directories were erroneously packages, removing the |
Hitting the same problems, we keep out tests in the packages, but we need importlib to work-around issues with namespaced package. Keeping our tests inside the namespaced package, even by removing the Moving the tests outside the namespace package fix it, but it's an unfortunate limitation. |
Actually, it only keep happening with the config:
Without this, removing the |
Using
--import-mode=importlib
is more lenient than the defaultimport-mode
, and so it allowed me to use*.test.py
rather than a valid module name e.g.*_.test.py
.Everything seemed to work correctly except explanations were missing:
instead of
The text was updated successfully, but these errors were encountered: