8000 TST: disable mypy tests in test suite unless an environment variable … · numpy/numpy@bd1bda6 · GitHub
[go: up one dir, main page]

Skip to content

Commit bd1bda6

Browse files
committed
TST: disable mypy tests in test suite unless an environment variable is set
These tests are super slow, and they're effectively always passing in CI. Running them on all "full" test suite runs is too expensive. Note that SciPy has an XSLOW mark, NumPy does not. So use an env var for now. [skip circle] [skip travis] [skip azp]
1 parent 9eb2d3b commit bd1bda6

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

.github/workflows/linux_meson.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,6 @@ jobs:
5353
env:
5454
TERM: xterm-256color
5555
run: |
56+
export NPY_RUN_MYPY_IN_TESTSUITE=1
5657
pip install pytest pytest-xdist hypothesis typing_extensions
5758
spin test -j auto

numpy/typing/tests/test_typing.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@
1818
_C_INTP,
1919
)
2020

21+
22+
# Only trigger a full `mypy` run if this environment variable is set
23+
# Note that these tests tend to take over a minute even on a macOS M1 CPU,
24+
# and more than that in CI.
25+
RUN_MYPY = "NPY_RUN_MYPY_IN_TESTSUITE" in os.environ
26+
if RUN_MYPY and RUN_MYPY not in ('0', '', 'false'):
27+
RUN_MYPY = True
28+
29+
# Skips all functions in this file
30+
pytestmark = pytest.mark.skipif(
31+
not RUN_MYPY,
32+
reason="`NPY_RUN_MYPY_IN_TESTSUITE` not set"
33+
)
34+
35+
2136
try:
2237
from mypy import api
2338
except ImportError:

0 commit comments

Comments
 (0)
0