From 03c42e13339872449617560042f2787c1b51d346 Mon Sep 17 00:00:00 2001 From: goodboy Date: Mon, 6 Apr 2026 18:29:07 -0400 Subject: [PATCH] Drop `xfail` from `test_moc_reentry_during_teardown` The per-`ctx_key` locking fix in f086222d intended to resolve the teardown race reproduced by the new test suite, so the test SHOULD now pass. TLDR, it doesn't Bp Also add `collapse_eg()` to the test's ctx-manager stack so that when run with `pytest <...> --tpdb` we'll actually `pdb`-REPL the RTE when it hits (previously an assert-error). (this commit-msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code --- tests/test_resource_cache.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/test_resource_cache.py b/tests/test_resource_cache.py index 450bc7c3..9b5b0336 100644 --- a/tests/test_resource_cache.py +++ b/tests/test_resource_cache.py @@ -12,6 +12,7 @@ import trio import tractor from tractor.trionics import ( maybe_open_context, + collapse_eg, ) from tractor.log import ( get_console_log, @@ -539,17 +540,17 @@ def test_per_ctx_key_resource_lifecycle( trio.run(main) -@pytest.mark.xfail( - reason=( - 'Demonstrates the `_Cache.run_ctx` teardown race: ' - 'a re-entering task hits ' - '`assert not resources.get(ctx_key)` because ' - '`values` was popped but `resources` was not yet ' - '(acm `__aexit__` checkpoint in between). ' - 'Fixed by per-`ctx_key` locking in 9e49eddd.' - ), - raises=AssertionError, -) +# @pytest.mark.xfail( +# reason=( +# 'Demonstrates the `_Cache.run_ctx` teardown race: ' +# 'a re-entering task hits ' +# '`assert not resources.get(ctx_key)` because ' +# '`values` was popped but `resources` was not yet ' +# '(acm `__aexit__` checkpoint in between). ' +# 'Fixed by per-`ctx_key` locking in 9e49eddd.' +# ), +# raises=AssertionError, +# ) def test_moc_reentry_during_teardown( debug_mode: bool, loglevel: str, @@ -621,6 +622,7 @@ def test_moc_reentry_during_teardown( debug_mode=debug_mode, loglevel=loglevel, ), + collapse_eg(), trio.open_nursery() as tn, ): tn.start_soon(use_and_exit)