-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
python_files=*.py
breaks with Python 3.10
#9174
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
Comments
What happens if you run that |
It works and prints |
Does it work with |
It does! |
I think your |
@jaraco i believe its a bug in the degraded files in import-lib, at first glance name is a method instead of a property, |
Agreed. The TypeError appears to be a bug, and a bug that's only present in importlib_resources 5.0.x and importlib.resources as found on CPython 3.10. I'm confident that making DegenerateFiles.Path.name a property will correct the proximate error, but correcting that error leads to another proximate failure:
Correcting that issue leads to a new failure, this one intended:
The ValueError here is indicating that |
I can confirm the issue was fixed in main:
I'll take care of reporting and fixing the interface issues with |
Filed bpo-45419 to track the identified interface issue. |
Thanks @jaraco and everyone. Closing this then as it is not something actionable on pytest. 👍 |
The fix for bpo-45419 just does what @jaraco already did in #9174 (comment), leaving this unresolved:
I'm still not sure if that's a Python issue, a certifi issue or a pytest issue. But right now the problem isn't gone, it's just producing a different error. |
I'm inclined to believe this is a cpython big since it used to work and changes there caused a regression |
The underlying issue was corrected in #9173.
If there is an outstanding Python bug, it's not yet clear what it is. The diff from Python 3.9 to 3.10 is roughly approximated by the diff between importlib_resources 1.3 -> 5.0. The I think it's possible that accessing resources for a loader without a resource loader was silently broken on Python 3.9 and is more noisily broken on 3.10, and perhaps that's for the best. I'm unsure if that shift in expectation was deliberate, but the impact seems to be minor (given that the issue hasn't bubbled up to a report in importlib_resources or importlib.resources). Perhaps it would make sense to turn the |
I think it would be best if you investigated this @jaraco given you're responsible for the bulk of the changes in importlib and that's the only variable here -- I don't think it's fair to discard this as "minor" just because you haven't heard about it yet |
I can confirm that this is still happening, but my error is yet another one: a I'm on Windows 10. Taking either # tests/test_requests
import requests conda create -c conda-forge -n py10 python=3.10.1
conda activate py10
pip install pytest requests
pytest tests (with python_files = "*.py") Thanks for all the effort so far! But should this issue be reopened? |
Just echoing it's happening to me too to hopefully make google show this to other people more easily. I was debugging and searching for two hours before getting here. Hopefully the other packages update soon. |
Consider this simple setup (no other files in the directory):
This has worked fine for previous versions of Python. Since 3.10, I'm getting this:
When changing
python_files
insetup.cfg
to anything other than*.py
(e.g.b*.py
), things work as expected again.I tried digging into why this happens, but it seems rather involved. The
method
mentioned in theTypeError
is this one:https://github.com/python/cpython/blob/67148254146948041a77d8a2989f41b88cdb2f99/Lib/importlib/_adapters.py#L49
I'm not sure what
DegenerateFiles
is and under which circumstances it is used. Also note that it has been removed from Python's main branch in this commit:python/cpython@aaa83cd
If
python_files=*.py
is problematic in general, pytest should throw a better error message. But of course I'd prefer it to be fixed since it lets me use shorter filenames when all my tests live in a dedicated directory.Thanks!
The text was updated successfully, but these errors were encountered: