MCPcopy Create free account
hub / github.com/FastLED/FastLED / test_cache_file_storage

Function test_cache_file_storage

ci/test_all_lint_caches_stress.py:248–286  ·  view source on GitHub ↗

Verify cache files are stored correctly.

(test: CacheLintStressTest)

Source from the content-addressed store, hash-verified

246
247
248def test_cache_file_storage(test: CacheLintStressTest) -> None:
249 """Verify cache files are stored correctly."""
250 print("\n📋 TEST 5: Cache File Storage")
251 print("-" * 70)
252
253 cache_dir = Path(".cache/fingerprint")
254 if not cache_dir.exists():
255 test.fail_test("Cache directory exists", "Directory not found")
256 return
257
258 # Check expected cache files
259 expected_files = [
260 "python_lint.json",
261 "js_lint.json",
262 "cpp_lint.json",
263 ]
264
265 found_count = 0
266 for cache_file in expected_files:
267 cache_path = cache_dir / cache_file
268 if cache_path.exists():
269 # Verify it's valid JSON (zccache-fingerprint format)
270 try:
271 with open(cache_path, "r") as f:
272 data = json.load(f)
273 # zccache-fingerprint writes {version, status, timestamp_ns, files/hash}
274 if "version" in data:
275 found_count += 1
276 test.pass_test(f"Cache file {cache_file} is valid zccache JSON")
277 else:
278 test.fail_test(
279 f"Cache file {cache_file}", "Missing 'version' field"
280 )
281 except json.JSONDecodeError as e:
282 test.fail_test(f"Cache file {cache_file}", f"Invalid JSON: {e}")
283 # It's okay if not all exist (some operations may not have run)
284
285 if found_count >= 1:
286 test.pass_test("At least one cache file stored correctly")
287
288
289def test_manifest_completeness(test: CacheLintStressTest) -> None:

Callers 1

mainFunction · 0.85

Calls 4

printFunction · 0.50
fail_testMethod · 0.45
loadMethod · 0.45
pass_testMethod · 0.45

Tested by

no test coverage detected