typeddjango / pytest-mypy-plugins

pytest plugin for testing mypy types, stubs, and plugins
https://pypi.org/project/pytest-mypy-plugins/
MIT License
102 stars 24 forks source link

Problem with pytest-xdist and cache #37

Open sobolevn opened 4 years ago

sobolevn commented 4 years ago

Sometimes, when we have both cache and xdist, this might happen:

[gw1] linux -- Python 3.8.5 /home/runner/work/returns/returns/.venv/bin/python
Traceback (most recent call last):
  File "/home/runner/work/returns/returns/.venv/lib/python3.8/site-packages/_pytest/runner.py", line 294, in from_call
    result = func()  # type: Optional[_T]
  File "/home/runner/work/returns/returns/.venv/lib/python3.8/site-packages/_pytest/runner.py", line 247, in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
  File "/home/runner/work/returns/returns/.venv/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/home/runner/work/returns/returns/.venv/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/runner/work/returns/returns/.venv/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/home/runner/work/returns/returns/.venv/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/home/runner/work/returns/returns/.venv/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/runner/work/returns/returns/.venv/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/home/runner/work/returns/returns/.venv/lib/python3.8/site-packages/_pytest/runner.py", line 161, in pytest_runtest_call
    raise e
  File "/home/runner/work/returns/returns/.venv/lib/python3.8/site-packages/_pytest/runner.py", line 153, in pytest_runtest_call
    item.runtest()
  File "/home/runner/work/returns/returns/.venv/lib/python3.8/site-packages/pytest_mypy_plugins/item.py", line 262, in runtest
    dependants = self.find_dependent_paths(path)
  File "/home/runner/work/returns/returns/.venv/lib/python3.8/site-packages/pytest_mypy_plugins/item.py", line 165, in find_dependent_paths
    if f'"{py_module}"' in path.read_text():
  File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/pathlib.py", line 1232, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/pathlib.py", line 1218, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/pathlib.py", line 1074, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/.mypy_cache/3.8/@plugins_snapshot.json.484c4696e62da2ed'

Build: https://github.com/dry-python/returns/pull/581/checks?check_run_id=1075226140#step:7:557