Many of our tests have type hints, primarily on fixtures and the test function parameters, but we have some remaining exclusions, as noted in #1229.
It is worth noting that consistency between elements are not all checked by mypy or pytest right now, so attention to detail will be important.
This could be an ideal first issue for you, but likely only if you have a background in Python Type Hints and pytest.
That said, the parameters to these test functions generally come in one of 4 categories:
- parameters with default values: that makes determining the type to use more straightforward
- parameters from a parametrize decorator: check the data in the list of values above the function name
- our fixtures: these will be in the test file, or in
conftest.py; look for the return type
- other fixtures: this is something like
mocker, which is a MockerFixture from pytest_mock
While working, you'll want to disable excluding the file from being checked by mypy by removing that line from pyproject.toml and adding to a separate commit before anything else. Check the commit log for the style used for other typing of test files (mainly by prah23).
It's likely worth working on one test function at a time in a separate commit, which we may squash together before merging. Once the file fully passes mypy cleanly, we can then move the first commit to the end, so that mypy doesn't complain before the file is fixed. That commit will then ensure that changes to that file will require type hints in future.
This is one element of #1229: please focus on this one file of that issue first, and if things go well, then you would be well situated to cover the remaining files later as followup PR(s). If you wish to work on a different file then please discuss in #zulip-terminal first.
Many of our tests have type hints, primarily on fixtures and the test function parameters, but we have some remaining exclusions, as noted in #1229.
It is worth noting that consistency between elements are not all checked by mypy or pytest right now, so attention to detail will be important.
This could be an ideal first issue for you, but likely only if you have a background in Python Type Hints and pytest.
That said, the parameters to these test functions generally come in one of 4 categories:
conftest.py; look for the return typemocker, which is aMockerFixturefrompytest_mockWhile working, you'll want to disable excluding the file from being checked by mypy by removing that line from
pyproject.tomland adding to a separate commit before anything else. Check the commit log for the style used for other typing of test files (mainly by prah23).It's likely worth working on one test function at a time in a separate commit, which we may squash together before merging. Once the file fully passes mypy cleanly, we can then move the first commit to the end, so that mypy doesn't complain before the file is fixed. That commit will then ensure that changes to that file will require type hints in future.