Open freakboy3742 opened 3 years ago
importing it directly from pytest_lazyfixture import lazy_fixture
(and using lazy_fixture
directly) seems to be a workaround
Without doing what @tadeu proposes, mypy (>=0.991) complains about this now:
error: "object" not callable [operator]
@TvoroG could you add proper typing for this project (see the typeshed stubs above)? It would make this issue go away generically! :)
The pytest devs consider monkey-patching invalid:
We no longer recommend to "install" things into the pytest namespace. +1 One of the reasons is static type checkers.
Hence, the solution (and not just a workaround) is this:
importing it directly from pytest_lazyfixture import lazy_fixture (and using lazy_fixture directly) seems to be a workaround
This is also the way it's documented in the pytest-lazyfixture
docs. So I think y'all can close this issue.
If you have a test suite that uses
pytest.lazy_fixture
, and you're using pytest 6.0.0+, and you run mypy over your test suite, mypy complains with the error:The test suite itself passes without any problems; it is only the type checking of mypy that fails.
This problem does not exist on pytest 5.4.3 or earlier.
I presume something has changed in the plugin registration process that prevents mypy from seeing the lazy_fixture attribute.