Skip to content

AttributeError: 'Config' object has no attribute '_mypy_results_path' #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andreas-wolf opened this issue Jan 26, 2024 · 4 comments · Fixed by #162
Closed

AttributeError: 'Config' object has no attribute '_mypy_results_path' #161

andreas-wolf opened this issue Jan 26, 2024 · 4 comments · Fixed by #162
Assignees

Comments

@andreas-wolf
Copy link

andreas-wolf commented Jan 26, 2024

I get this error when using the plugin v0.10.3 together with xdist 3.5.0
addopts = --numprocesses=auto --mypy

.nox/tests-3-12/lib/python3.12/site-packages/_pytest/main.py:306: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: terminalreporter, Hook: pytest_sessionfinish
AttributeError: 'Config' object has no attribute '_mypy_results_path'

@GergelyKalmar
Copy link

I see the same, seems to be the case since pluggy 1.4.0: https://github.com/pytest-dev/pluggy/blob/main/CHANGELOG.rst#pluggy-140-2024-01-24

@GergelyKalmar
Copy link

I also got this as a reference in the logs: For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning

@dmtucker
Copy link
Collaborator

dmtucker commented Feb 3, 2024

Hey thanks for the report!
I haven't been able to repro with Python 3.12, pytest-xdist-3.5.0, and pluggy-1.4.0 🤔

$ venv/bin/pytest --mypy -n auto demo/test_demo.py 
====================== test session starts =======================
platform linux -- Python 3.12.1, pytest-8.0.0, pluggy-1.4.0
Using --randomly-seed=3813770279
rootdir: /home/dtux/Projects/pytest-mypy
configfile: tox.ini
plugins: xdist-3.5.0, mypy-0.10.3, randomly-3.15.0, forked-1.6.0, cov-2.12.1
8 workers [4 items]     
...F                                                       [100%]
============================ FAILURES ============================
__________________________ test session __________________________
[gw1] linux -- Python 3.12.1 /home/dtux/Projects/pytest-mypy/venv/bin/python
mypy exited with status 1.
============================== mypy ==============================
demo/uncollected.py:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")  [assignment]
Found 1 error in 1 file (checked 1 source file)
==================== short test summary info =====================
FAILED demo/test_demo.py::mypy1.8.0-status
================== 1 failed, 3 passed in 1.39s ===================

What version of Pytest are you using?

@GergelyKalmar
Copy link

The requirements:

pytest==7.4.4
mypy==1.8.0
pytest-mypy==0.10.3
pytest-xdist[psutil]==3.5.0

Reproducer (test.py):

x: int = 'invalid'

Invoke it as pytest --mypy -n auto.

I'm using Python 3.8 on Ubuntu 20.04.

Looks like the issue is gone with pytest 8.0 though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants