Search code examples
pytestimporterrorpython-3.10pandera

pytest issue with pandera


I wrote a test to experiment with pandera for DataFrame validation. I put the validation schema in a pytest fixture and passed it to the unit test I had. Now, I have this odd issue: when I pip install pandera into my virtual environment, pytest stops workings, the entire test suite fails to run (not just this one test), and I get this import error:

ImportError: cannot import name 'Config' from 'pytest'

I'm using python3.10.

I do have an __init__.py file in my test folder, but that was not an issue before. I only get this error when I install pandera

I blew the virtual environment and created a fresh one without pandera installed, and the other unit tests I had in the suite passed just fine. Installed pandera and the same import error showed up.

Has anybody run into this before?


Solution

  • I encountered the same problem using pytest 6.2.5. It seems the issue appears with pandera versions >= 0.15.0. Downgrading pandera to 0.14.5 "solved" the issue for me.

    That's no permanent solution, though. I'll open an issue for pandera, hoping someone can fix it soon.

    Edit: the the currently latest pytest version 7.4.0 also seems to work with pandera >=0.15.0