Skip to content

Commit 458047f

Browse files
authored
Fix the disable_actor_auto_restart fixture (#97)
The fixture didn't always work because in cases where the actor kept running past the pytest session end, and failed then, the original restart limit was reestablished, running into the infinite loop again. Maybe related to #41.
2 parents 2833ca0 + e048f4e commit 458047f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/conftest.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
def disable_actor_auto_restart(): # type: ignore
1616
"""Disable auto-restart of actors while running tests.
1717
18-
Since this is auto-use, the yield part (and restore of the variable) is not
19-
strictly needed, but we leave it as an example.
18+
At some point we had a version that would set the limit back to the
19+
original value but it doesn't work because some actors will keep running
20+
even after the end of the session and fail after the original value was
21+
reestablished, getting into an infinite loop again.
2022
2123
Note: Test class must derive after unittest.IsolatedAsyncioTestCase.
2224
Otherwise this fixture won't run.
2325
"""
24-
original_restart_limit = _decorator.BaseActor.restart_limit
2526
_decorator.BaseActor.restart_limit = 0
26-
yield
27-
_decorator.BaseActor.restart_limit = original_restart_limit

0 commit comments

Comments
 (0)