You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
exceptiongroup python version import check not compatible with poetry/virtualenv #10956
I'm hitting a problem where using poetry (together with Tox testing matrix) will fail system checks introduced in #10209
Indeed the python version installed system wide is 3.11, but when testing with multiple python versions with Tox and virtual envs, this fails, because the system installed python and environment python is not the same. So
if sys.version_info[:2] < (3, 11):
from exceptiongroup import BaseExceptionGroup
Will try to import BaseExceptionGroup even though it's being ran in Python <= 3.10
Traceback (most recent call last):
File "/home/runner/.cache/pypoetry/virtualenvs/my-package-koh7-DBw-py3.10/bin/py.test", line 5, in <module>
from pytest import console_main
File "/home/runner/.cache/pypoetry/virtualenvs/my-package-koh7-DBw-py3.10/lib/python3.10/site-packages/pytest/__init__.py", line 5, in <module>
from _pytest._code import ExceptionInfo
File "/home/runner/.cache/pypoetry/virtualenvs/my-package-koh7-DBw-py3.10/lib/python3.10/site-packages/_pytest/_code/__init__.py", line 2, in <module>
from .code import Code
File "/home/runner/.cache/pypoetry/virtualenvs/my-package-koh7-DBw-py3.10/lib/python3.10/site-packages/_pytest/_code/code.py", line 60, in <module>
from exceptiongroup import BaseExceptionGroup
ModuleNotFoundError: No module named 'exceptiongroup'
Error: Process completed with exit code 1.
I don't think it's about the line you mention.
The tests run ok in Py3.11, and fails on all others bellow.
I'm using github actions actions/setup-python@v4.5.0 to set the python version.
I will continue to investigate to check if there's anything I missed in the pipepilne.
I encountered this issue. In my case, I started with a Python 3.11 dev container with poetry pegged to the 3.11 version. I opened up the version to 3.10 but forgot to rebuild the poetry lock file. The fix was to run poetry lock and commit the updated lock file.
Activity
RonnyPfannschmidt commentedon Apr 29, 2023
You mean https://github.com/pytest-dev/pytest/blob/main/setup.cfg#L51
Please verify if this is a poetry issue
Based on the spec it should work
sergioisidoro commentedon Apr 29, 2023
I don't think it's about the line you mention.
The tests run ok in Py3.11, and fails on all others bellow.
I'm using github actions
actions/setup-python@v4.5.0to set the python version.I will continue to investigate to check if there's anything I missed in the pipepilne.
sergioisidoro commentedon Apr 29, 2023
Indeed it does not seem to be a problem with pytest.
version_infois correct, even in the CI envStill no idea what's going on...
RonnyPfannschmidt commentedon Apr 29, 2023
Is the poetry dependency resolver running on the right python version?
JamesHutchison commentedon May 17, 2023
I encountered this issue. In my case, I started with a Python 3.11 dev container with poetry pegged to the 3.11 version. I opened up the version to 3.10 but forgot to rebuild the poetry lock file. The fix was to run
poetry lockand commit the updated lock file.