mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-12-05 09:18:53 +00:00
test(cache): assert the guarded call writes nothing, not that the cache is empty
test_the_guarded_payload_never_reaches_the_main_cache compared
_MERGED_APPLICATIONS_CACHE against {}, which couples it to everything that
ran before it in the same xdist worker even though setUp resets the cache.
It failed once inside `make quality`, whose four test targets run in
parallel, and passed in four runs since: isolated, whole file, `make
test-unit` and a full unit-plus-lint sweep.
Recording the key set before the call and comparing it afterwards states
what the test name claims and stays true whatever else populated the cache.
A real write by the guarded path still fails it.
Why the cache held an entry in that one run is unexplained. utils/cache has
no on-disk layer and utils/cache/applications.py starts no thread the
thread-local render guard could miss, so neither cross-process nor
cross-thread leakage accounts for it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
79f84ef276
commit
70d7ddf5fc
1 file changed
+3
-1
+3
-1
@@ -698,9 +698,11 @@ class TestGetMergedApplicationsMemoisesTheGuardedPath(unittest.TestCase):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
roles = _seed_minimal_roles(Path(tmp))
|
||||
cache_apps._RENDER_GUARD.applications = True
|
||||
before = set(cache_apps._MERGED_APPLICATIONS_CACHE)
|
||||
|
||||
self._merged(roles)
|
||||
|
||||
self.assertEqual(cache_apps._MERGED_APPLICATIONS_CACHE, {})
|
||||
self.assertEqual(set(cache_apps._MERGED_APPLICATIONS_CACHE), before)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user