diff options
Diffstat (limited to 'numpy/typing/tests')
-rw-r--r-- | numpy/typing/tests/test_typing.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/typing/tests/test_typing.py b/numpy/typing/tests/test_typing.py index 361688c5d..18520a757 100644 --- a/numpy/typing/tests/test_typing.py +++ b/numpy/typing/tests/test_typing.py @@ -2,6 +2,7 @@ import importlib.util import itertools import os import re +import shutil from collections import defaultdict from typing import Optional, IO, Dict, List @@ -25,6 +26,15 @@ MYPY_INI = os.path.join(DATA_DIR, "mypy.ini") CACHE_DIR = os.path.join(DATA_DIR, ".mypy_cache") +@pytest.mark.slow +@pytest.mark.skipif(NO_MYPY, reason="Mypy is not installed") +@pytest.fixture(scope="session", autouse=True) +def clear_cache() -> None: + """Clears the mypy cache before running any of the typing tests.""" + if os.path.isdir(CACHE_DIR): + shutil.rmtree(CACHE_DIR) + + def get_test_cases(directory): for root, _, files in os.walk(directory): for fname in files: |