Stress test with larger files.
()
| 247 | |
| 248 | |
| 249 | def 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 | |
| 292 | def test_edge_case_symlinks() -> None: |
nothing calls this directly
no test coverage detected