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

Function test_missing_files

ci/test_hash_fingerprint_stress.py:321–348  ·  view source on GitHub ↗

Test handling of missing files (file deleted from monitored directory).

(results: StressTestResults)

Source from the content-addressed store, hash-verified

319
320
321def test_missing_files(results: StressTestResults) -> None:
322 """Test handling of missing files (file deleted from monitored directory)."""
323 print("\n📋 TEST 6: Missing File Handling")
324 print("-" * 70)
325
326 with tempfile.TemporaryDirectory() as temp_dir:
327 temp_path = Path(temp_dir)
328 test_dir = temp_path / "test_files"
329 cache_dir = temp_path / ".cache"
330
331 files = create_test_files(test_dir, 5)
332 root = str(test_dir)
333 cache = HashFingerprintCache(cache_dir, "missing_test")
334
335 # First check with all files present
336 cache.check_needs_update(include=_TEST_INCLUDE, root=root)
337 cache.mark_success()
338 results.pass_test("Initial cache with all files")
339
340 # Delete a file
341 files[0].unlink()
342
343 # Check should detect change (file set changed)
344 needs_update = cache.check_needs_update(include=_TEST_INCLUDE, root=root)
345 if needs_update:
346 results.pass_test("Cache detects missing file as change")
347 else:
348 results.fail_test("Cache detects missing file", "Got cache hit instead")
349
350
351def test_cache_corruption_recovery(results: StressTestResults) -> None:

Callers 1

mainFunction · 0.85

Calls 8

check_needs_updateMethod · 0.95
mark_successMethod · 0.95
unlinkMethod · 0.80
create_test_filesFunction · 0.70
printFunction · 0.50
pass_testMethod · 0.45
fail_testMethod · 0.45

Tested by

no test coverage detected