mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
943af79f26
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 in6d8a58f7e1
. 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 sincebab1e4f8a1
where the _get_pages method was removed.
78 lines
1.8 KiB
YAML
78 lines
1.8 KiB
YAML
exclude: 'src/pip/_vendor/'
|
|
|
|
repos:
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v3.4.0
|
|
hooks:
|
|
- id: check-builtin-literals
|
|
- id: check-added-large-files
|
|
- id: check-case-conflict
|
|
- id: check-toml
|
|
- id: check-yaml
|
|
- id: debug-statements
|
|
- id: end-of-file-fixer
|
|
exclude: WHEEL
|
|
- id: forbid-new-submodules
|
|
- id: trailing-whitespace
|
|
exclude: .patch
|
|
|
|
- repo: https://github.com/psf/black
|
|
rev: 21.7b0
|
|
hooks:
|
|
- id: black
|
|
|
|
- repo: https://gitlab.com/pycqa/flake8
|
|
rev: 3.8.4
|
|
hooks:
|
|
- id: flake8
|
|
additional_dependencies: [
|
|
'flake8-bugbear==20.1.4',
|
|
'flake8-logging-format==0.6.0',
|
|
'flake8-implicit-str-concat==0.2.0',
|
|
]
|
|
exclude: tests/data
|
|
|
|
- repo: https://github.com/PyCQA/isort
|
|
rev: 5.7.0
|
|
hooks:
|
|
- id: isort
|
|
files: \.py$
|
|
|
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
rev: v0.910
|
|
hooks:
|
|
- id: mypy
|
|
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',
|
|
]
|
|
|
|
- repo: https://github.com/pre-commit/pygrep-hooks
|
|
rev: v1.7.0
|
|
hooks:
|
|
- id: python-no-log-warn
|
|
- id: python-no-eval
|
|
- id: rst-backticks
|
|
files: .*\.rst$
|
|
types: [file]
|
|
exclude: NEWS.rst # The errors flagged in NEWS.rst are old.
|
|
|
|
- repo: local
|
|
hooks:
|
|
- id: news-fragment-filenames
|
|
name: NEWS fragment
|
|
language: fail
|
|
entry: NEWS fragment files must be named *.(process|removal|feature|bugfix|vendor|doc|trivial).rst
|
|
exclude: ^news/(.gitignore|.*\.(process|removal|feature|bugfix|vendor|doc|trivial).rst)
|
|
files: ^news/
|
|
|
|
- repo: https://github.com/mgedmin/check-manifest
|
|
rev: '0.46'
|
|
hooks:
|
|
- id: check-manifest
|
|
stages: [manual]
|