agronholm / typeguard

Run-time type checker for Python
Other
1.5k stars 112 forks source link

pytest plugin might need to be adapted to changes in global config import #455

Closed viv-vek closed 4 months ago

viv-vek commented 4 months ago

Things to check first

Typeguard version

4.21

Python version

3.10

What happened?

while running pytest test cases , it fails early with the following error.

Import Error: cannot import name 'Config' from 'pytest' A bit of digging points to the the script _pytest_plugin.py in the following import

**from pytest import Config, Parser**

pytest seems to have changed the how to import global config.

How can we reproduce the bug?

run any pytest test case with latest version of pytest and typeguard 4.2.1.

agronholm commented 4 months ago

I just tested and this import works with pytest 8.1.1. What version are you running on?

viv-vek commented 4 months ago

i see ..we run with nox just checked the latest run its on pytest 6.2.5

agronholm commented 4 months ago

Typeguard's own tests require a minimum of pytest 7.

viv-vek commented 4 months ago

yes tested them now in two different environments. it works with pytest 8.1.1. Do you know of a minimum version of pytest that this support is in? Its because we have other libs which need to be compatible with the chosen version of pytest. so expecting to specify a range in my requirements file. Thanks a ton for a instant response.

agronholm commented 4 months ago

I believe it is specifically pytest 7, as they made backwards incompatible API changes there.