Incompatible with mypy
Hello, thanks for the great project!
I've got a very simple example that doesn't work with mypy:
from pytest_check.context_manager import CheckContextManager
def test_something(check: CheckContextManager) -> None:
check.equal(1, 2, "oops")
Running this code with mypy strict=true yields:
tests/__init__.py:5: error: "CheckContextManager" has no attribute "equal" [attr-defined]
check.equal(1, 2, "oops")
Pycharm also complains:
This was originally reported in #175 regarding pylint, this is a slightly different context with mypy.
This is caused by the dynamic nature of adding in attributes to the CheckContextManager instance:
https://github.com/okken/pytest-check/blob/6bf2b2292c52dd9380aa83366b863e6d81400675/src/pytest_check/init.py#L30-L49
I can see why you might want to do this dynamically and not have the source of truth be on ContextManager instance, but would you consider adding a context_manager.pyi type stub that denotes these functions do in fact get added to ContextManager? I believe that's the solution for this problem.
One workaround is to not use the context manager. If I update the test to use the global import:
import pytest_check
def test_something() -> None:
pytest_check.equal(1, 2, "oops")
Then mypy is now happy
I think a stub is a good idea.