MCPcopy Create free account
hub / github.com/TheSecuredAnalyst/security-suite / temp_cache

Function temp_cache

tests/test_cache.py:12–25  ·  view source on GitHub ↗

Create temporary cache for testing.

(tmp_path)

Source from the content-addressed store, hash-verified

10
11@pytest.fixture
12def temp_cache(tmp_path):
13 """Create temporary cache for testing."""
14 cache = ScanCache(ttl_seconds=3600)
15 cache.cache_dir = tmp_path / "cache"
16 cache.cache_dir.mkdir(parents=True, exist_ok=True)
17 cache._memory_cache.clear() # Clear memory cache before test
18 # Clear any existing cache files
19 for cache_file in cache.cache_dir.glob("*.json"):
20 cache_file.unlink()
21 yield cache
22 cache._memory_cache.clear() # Clear memory cache after test
23 # Clean up cache files after test
24 for cache_file in cache.cache_dir.glob("*.json"):
25 cache_file.unlink()
26
27
28@pytest.fixture

Callers

nothing calls this directly

Calls 2

ScanCacheClass · 0.90
clearMethod · 0.80

Tested by

no test coverage detected