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

Broken disable_check logic #82

Closed zero323 closed 3 years ago

zero323 commented 3 years ago

I might be wrong, but it seems like the conditions for invoking cache removal has been unintentionally reversed:

https://github.com/typeddjango/pytest-mypy-plugins/blob/a2d4adde12b0024e62f2e1661fd0dd5abb4f9191/pytest_mypy_plugins/item.py#L297-L304

As-is, cache is removed when disable_cache is False and preserved when it is True.

zero323 commented 3 years ago

Forget that, please.

Just for the context ‒ I am trying to investigate some issues related to caching behavior. When testing project with complex dependencies, I see serious performance degradation compared to running internal mypy tests.

I thought the issue was here, but it seems it might be actually with find_dependent_paths

https://github.com/typeddjango/pytest-mypy-plugins/blob/a2d4adde12b0024e62f2e1661fd0dd5abb4f9191/pytest_mypy_plugins/item.py#L187

Since it uses at least main.py it includes all kinds of packages with main.py, for example

['/tmp/.mypy_cache/3.9/pdb',
 '/tmp/.mypy_cache/3.9/unittest/main',
 '/tmp/.mypy_cache/3.9/unittest/__init__',
 '/tmp/.mypy_cache/3.9/_pytest/pytester',
 '/tmp/.mypy_cache/3.9/_pytest/config/__init__',
 '/tmp/.mypy_cache/3.9/pytest/__init__',
 '/tmp/.mypy_cache/3.9/asyncio/runners']

This seems to escalate, and break caching in general.