realpython / pytest-mypy

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

INTERNALERROR with pytest-xdist #102

Closed MartinThoma closed 4 years ago

MartinThoma commented 4 years ago

I had the following installed:

$ time pytest -n 4              
/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/pytest_benchmark/logger.py:44: PytestBenchmarkWarning: Benchmarks are automatically disabled because xdist plugin is active.Benchmarks cannot be performed reliably in a parallelized environment.
  warner(PytestBenchmarkWarning(text))
Test session starts (platform: linux, Python 3.8.4, pytest 6.0.1, pytest-sugar 0.9.4)
benchmark: 3.2.3 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/moose/GitHub/MartinThoma/mpu, configfile: setup.cfg
plugins: cov-2.10.1, timeout-1.4.2, requests-mock-1.8.0, benchmark-3.2.3, mccabe-1.0, sugar-0.9.4, mypy-0.6.2, black-0.3.10, hypothesis-5.23.8, leaks-0.3.1, forked-1.3.0, xdist-2.0.0
timeout: 30.0s
timeout method: signal
timeout func_only: False
gw0 C / gw1 I / gw2 I / gw3 IINTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/_pytest/main.py", line 238, in wrap_session
INTERNALERROR>     config.hook.pytest_sessionstart(session=session)
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/xdist/dsession.py", line 78, in pytest_sessionstart
INTERNALERROR>     nodes = self.nodemanager.setup_nodes(putevent=self.queue.put)
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/xdist/workermanage.py", line 65, in setup_nodes
INTERNALERROR>     return [self.setup_node(spec, putevent) for spec in self.specs]
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/xdist/workermanage.py", line 65, in <listcomp>
INTERNALERROR>     return [self.setup_node(spec, putevent) for spec in self.specs]
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/xdist/workermanage.py", line 73, in setup_node
INTERNALERROR>     node.setup()
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/xdist/workermanage.py", line 260, in setup
INTERNALERROR>     self.config.hook.pytest_configure_node(node=self)
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/moose/.pyenv/versions/3.8.4/lib/python3.8/site-packages/pytest_mypy.py", line 58, in pytest_configure_node
INTERNALERROR>     node.slaveinput['_mypy_results_path'] = \
INTERNALERROR> AttributeError: 'WorkerController' object has no attribute 'slaveinput'

with the following packages:

pytest==6.0.1
pytest-cov==2.10.1
pytest-mccabe==1.0
pytest-xdist==2.0.0
pytest-mypy==0.6.2

After uninstalling pytest-cov it worked.

I think this is related to https://github.com/pytest-dev/pytest-xdist/issues/577 and https://github.com/pytest-dev/pytest-cov/issues/422

dmtucker commented 4 years ago

Thanks for the report! This is indeed caused by incompatible changes in pytest-xdist 2; however it should already be fixed by #101 :blush: I will try to get a release out today.