From a891c07d040067d42e35b25c558f0969cca2715c Mon Sep 17 00:00:00 2001 From: Bas van Beek Date: Fri, 15 Jan 2021 18:22:57 +0100 Subject: TST: Clear the mypy cache before running any typing tests --- numpy/typing/tests/test_typing.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'numpy') 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: -- cgit v1.2.1