diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2021-08-21 22:04:11 -0600 |
---|---|---|
committer | Jon Dufresne <jon.dufresne@gmail.com> | 2021-08-22 09:57:26 -0600 |
commit | 943af79f2629e9e98260769582cde3c31d24db91 (patch) | |
tree | 719dff89cf162a43ae853d32ae6dd58fc2f18469 /.pre-commit-config.yaml | |
parent | 3e640bc0ad2c78506c4b70f2704ba7a6ec86a6c2 (diff) | |
download | pip-943af79f2629e9e98260769582cde3c31d24db91.tar.gz |
Run mypy on the tests directory
The tests are a large consumer of the pip API (both the internal API and
otherwise). By running mypy on tests, we help to:
1. Ensure the internal API is consistent with regards to typing
2. Ensure the tests are representative of real life scenarios as the API
are used correctly.
3. Helps to recognize unnecessary tests that simply pass junk data to
functions which can be caught by the type checker.
4. Make sure test support code in tests/lib/ is correct and consistent.
This is especially important when refactoring such code. For example, if
we were to replace tests/lib/path.py with pathlib.
As a first start, untyped defs are allowed. All existing typing issues
have been resolved. Overtime, we can chip away at untyped defs and
eventually remove the configuration option for stricter type checking of
tests.
The following changes were made to help make mypy pass:
Remove unused record_callback argument from make_wheel() in tests.
Unused since its introduction in
6d8a58f7e136df92704d2334288e4589d91a082b.
Replace toml with tomli_w in tests/functional/test_pep517.py. Unlike the
toml package, tomli_w contains inline typing annotations.
Remove unnecessary make_no_network_finder(). Unnecessary since
bab1e4f8a1a3ba5f5f08207c83a4e0a7a87ea615 where the _get_pages method was
removed.
Diffstat (limited to '.pre-commit-config.yaml')
-rw-r--r-- | .pre-commit-config.yaml | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e33aa41ef..b68022f94 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,12 +42,13 @@ repos: rev: v0.910 hooks: - id: mypy - exclude: tests + exclude: tests/data args: ["--pretty", "--show-error-codes"] additional_dependencies: [ 'keyring==23.0.1', 'nox==2021.6.12', 'types-docutils==0.1.8', + 'types-setuptools==57.0.2', 'types-six==0.1.9', ] |