ImportWarning re-triggered with unittest.mock.patch().__enter__
#99716
Labels
type-bug
An unexpected behavior, bug, or error
Bug report
This only happens with Python 3.11
The minimal reproducer I could come up with:
./foo/__init__.py
./tests/__init__.py
Running this with
python -m unittest tests
, I get the following errorA clear and concise description of what the bug is.
Include a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible.
Your environment
In case you were wondering why I would import
from urllib3.packages.six.moves.http_client import IncompleteRead
: that's an indirect (over multiple hops) dependency of my actual test code. I found this line inurllib3
and figured I can reduce the reproducer for this weird issue with directly using that import.Originally, if that matters, it's
in
urllib3/exceptions.py
.I'm aware that there is an external library involved, but seeing that the stack trace goes through some C extensions in importlib, I suspect this, while being triggered with the external lib, has it's root-cause somewhere else.
The text was updated successfully, but these errors were encountered: