Stress test with rapid cache operations.
()
| 218 | |
| 219 | |
| 220 | def test_stress_rapid_operations() -> None: |
| 221 | """Stress test with rapid cache operations.""" |
| 222 | with tempfile.TemporaryDirectory() as temp_dir: |
| 223 | temp_path = Path(temp_dir) |
| 224 | test_dir = temp_path / "test_files" |
| 225 | cache_dir = temp_path / ".cache" |
| 226 | cache_dir.mkdir(exist_ok=True) |
| 227 | |
| 228 | create_test_files(test_dir, 10) |
| 229 | include = ["**/*.txt"] |
| 230 | root = str(test_dir) |
| 231 | |
| 232 | # TwoLayerFingerprintCache stress |
| 233 | two_layer = TwoLayerFingerprintCache(cache_dir, "stress_two_layer") |
| 234 | for _ in range(10): |
| 235 | needs_update = two_layer.check_needs_update(include=include, root=root) |
| 236 | if needs_update: |
| 237 | two_layer.mark_success() |
| 238 | two_layer.invalidate() |
| 239 | |
| 240 | # HashFingerprintCache stress |
| 241 | hash_cache = HashFingerprintCache(cache_dir, "stress_hash") |
| 242 | for _ in range(10): |
| 243 | needs_update = hash_cache.check_needs_update(include=include, root=root) |
| 244 | if needs_update: |
| 245 | hash_cache.mark_success() |
| 246 | hash_cache.invalidate() |
| 247 | |
| 248 | |
| 249 | def test_stress_large_files() -> None: |
nothing calls this directly
no test coverage detected