From a8b5d5a8cffef6c78a4ff4de3c4257bd6e0335e5 Mon Sep 17 00:00:00 2001 From: horw Date: Mon, 27 Nov 2023 19:46:05 +0800 Subject: [PATCH] feat: when testing plugin itself remove cache file --- conftest.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/conftest.py b/conftest.py index c58c98d4..a39fecf3 100644 --- a/conftest.py +++ b/conftest.py @@ -18,6 +18,14 @@ def copy_fixtures(testdir): yield +@pytest.fixture(autouse=True) +def cache_file_remove(cache_dir): + yield + _cache_file_path = os.path.join(cache_dir, 'port_target_cache') + if os.path.exists(_cache_file_path): + os.remove(_cache_file_path) + + @pytest.fixture def first_index_of_messages(): def _fake(_pattern: Pattern, _messages: List[str], _start: int = 0) -> int: