Skip to content

Commit a6e17ee

Browse files
committed
Update mypy config to allow multiple test.py files
1 parent 0d9a30a commit a6e17ee

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Diff for: .mypy.ini

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[mypy]
2+
mypy_path = $MYPY_CONFIG_FILE_DIR/testsuite

Diff for: .pre-commit-config.yaml

+19-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,24 @@ repos:
2222
hooks:
2323
- id: mypy
2424
files: '\.py$'
25-
# exclude: "^tests/.+$"
25+
args:
26+
# These flags make mypy associate different module names to `test.py`
27+
# files from different test directories.
28+
- --explicit-package-bases
29+
- --namespace-packages
2630
additional_dependencies:
2731
- pytest-lsp
32+
- e3-testsuite
33+
- psutil
34+
- types-psutil
35+
36+
- repo: local
37+
hooks:
38+
# This hook checks that Python test directories are valid module names so
39+
# that mypy will accept to analyse multiple test.py in different
40+
# directories.
41+
- id: py-filenames
42+
name: Python test.py paths
43+
entry: Python path components should be valid modules names (e.g. no '.' or whitespace). This is for mypy to accept dealing with test.py files in different directories.
44+
language: fail
45+
files: 'testsuite.*[^A-Za-z0-9_\/].*test\.py$'

0 commit comments

Comments
 (0)