realpython / pytest-mypy

Mypy static type checker plugin for Pytest
https://pypi.org/project/pytest-mypy/
MIT License
248 stars 32 forks source link

Upgrading to 0.10.2 leads to `exceptiongroup` error #150

Closed alexdewar closed 1 week ago

alexdewar commented 1 year ago

After upgrading to v0.10.2 my CI system started failing, giving the following error:

Traceback (most recent call last):
  File "/home/alex/code/FINESSE/.venv/bin/pytest", line 5, in <module>
    from pytest import console_main
  File "/home/alex/code/FINESSE/.venv/lib/python3.9/site-packages/pytest/__init__.py", line 5, in <module>
    from _pytest._code import ExceptionInfo
  File "/home/alex/code/FINESSE/.venv/lib/python3.9/site-packages/_pytest/_code/__init__.py", line 2, in <module>
    from .code import Code
  File "/home/alex/code/FINESSE/.venv/lib/python3.9/site-packages/_pytest/_code/code.py", line 60, in <module>
    from exceptiongroup import BaseExceptionGroup
ModuleNotFoundError: No module named 'exceptiongroup'

Full output here: https://github.com/ImperialCollegeLondon/FINESSE/pull/58

It appears that the exceptiongroup package is not being installed via poetry, though it isn't obvious why.

Any ideas?

dmtucker commented 1 year ago

Looks like Poetry expects 3.11+: https://github.com/ImperialCollegeLondon/FINESSE/pull/58/files#diff-f53a023eedfa3fbf2925ec7dc76eecdc954ea94b7e47065393dbad519613dc89R868

Your failing run is 3.9, though, and pytest requires the exceptiongroup package on 3.9 (presumably because exception groups aren't added to the language until 3.11): https://github.com/pytest-dev/pytest/blob/fd30759d94d16357441d50d5a82ca88e423da5c0/setup.cfg#L52

dmtucker commented 1 week ago

This does not appear to be related to pytest-mypy. Please reopen if that's not correct.