-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Reported by @gvanrossum in #3870 :
Sadly there's a problem with this. When I run the tests as follows:
pytest -n0 mypy/test/testcmdline.py
every test in that file fails. Apparently the pytest-xdist extension which runs tests in parallel does something that keeps the tests from failing. The error is essentially that every subprocess invoking scripts/mypy fails with the following traceback:
Traceback (most recent call last):
File "/Users/guido/src/mypy/scripts/mypy", line 4, in <module>
from mypy.main import main
ModuleNotFoundError: No module named 'mypy.main'
This makes sense as the current directory is set to the temporary directory where the test files are written, so the repo root is not on sys.path. I'm guessing that the xdist extension somehow retains the current directory?
The pythoneval tests fail in the same way.
(End quote)
On my machine most of the tests pass, except testCoberturaParser
:
Expected:
<coverage timestamp="$TIMESTAMP" version="$VERSION" line-rate="0.8000" branch-rate="0"> (diff)
...
Actual:
<coverage timestamp="$TIMESTAMP" version="0.530" line-rate="0.8000" branch-rate="0"> (diff)
...
Apparently pytest-xdist
adds mypy's base dir to PYTHONPATH.
This issue has two items:
- Fix the failures
- Add tests to prevent the reintroduction of such failures