Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7de0dbb

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 f953645 commit 7de0dbb

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
@@ -68,5 +68,6 @@ jobs:
6868
TERM: xterm-256color
6969
LD_LIBRARY_PATH: "/usr/local/lib/" # to find libopenblas.so.0
7070
run: |
71+
export NPY_RUN_MYPY_IN_TESTSUITE=1
7172
pip install pytest pytest-xdist hypothesis typing_extensions
7273
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)