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

Function test_stress_large_files

ci/tests/test_fingerprint_integration.py:249–289  ·  view source on GitHub ↗

Stress test with larger files.

()

Source from the content-addressed store, hash-verified

247
248
249def test_stress_large_files() -> None:
250 """Stress test with larger files."""
251 with tempfile.TemporaryDirectory() as temp_dir:
252 temp_path = Path(temp_dir)
253 test_dir = temp_path / "test_files"
254 cache_dir = temp_path / ".cache"
255 cache_dir.mkdir(exist_ok=True)
256
257 # Create files with larger content (10KB each)
258 files: list[Path] = []
259 for i in range(5):
260 file_path = test_dir / f"large_file_{i}.txt"
261 file_path.parent.mkdir(parents=True, exist_ok=True)
262 large_content = f"Line {i}\n" * 1000 # ~10KB
263 file_path.write_text(large_content)
264 files.append(file_path)
265
266 include = ["**/*.txt"]
267 root = str(test_dir)
268
269 # TwoLayerFingerprintCache with large files
270 two_layer = TwoLayerFingerprintCache(cache_dir, "large_two_layer")
271 start = time.time()
272 needs_update = two_layer.check_needs_update(include=include, root=root)
273 elapsed = time.time() - start
274
275 assert needs_update, "TwoLayerFingerprintCache: Should detect new large files"
276 assert elapsed < 5.0, (
277 f"TwoLayerFingerprintCache: Large files took {elapsed:.3f}s (expected < 5.0s)"
278 )
279
280 # HashFingerprintCache with large files
281 hash_cache = HashFingerprintCache(cache_dir, "large_hash")
282 start = time.time()
283 needs_update = hash_cache.check_needs_update(include=include, root=root)
284 elapsed = time.time() - start
285
286 assert needs_update, "HashFingerprintCache: Should detect new large files"
287 assert elapsed < 5.0, (
288 f"HashFingerprintCache: Large files took {elapsed:.3f}s (expected < 5.0s)"
289 )
290
291
292def test_edge_case_symlinks() -> None:

Callers

nothing calls this directly

Calls 6

check_needs_updateMethod · 0.95
check_needs_updateMethod · 0.95
timeMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected