File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 11import asyncio
22import contextlib
3+ import os
34from unittest .mock import Mock
45
56import pytest
67
78from reflex .utils .tasks import ensure_task
89
10+ CI = bool (os .environ .get ("CI" , False ))
11+
912
1013class NotSuppressedError (Exception ):
1114 """An exception that should not be suppressed."""
@@ -72,13 +75,13 @@ async def faulty_coro(): # noqa: RUF029
7275
7376
7477async def test_ensure_task_limit_window_passed ():
75- """Test that ensure_task raises after exceeding exception limit within the limit window."""
78+ """Test that ensure_task resets exception limit past the limit window."""
7679 call_count = 0
7780
7881 async def faulty_coro ():
7982 nonlocal call_count
8083 call_count += 1
81- await asyncio .sleep (0.05 )
84+ await asyncio .sleep (0.5 if CI else 0. 05 )
8285 if call_count > 3 :
8386 raise RuntimeError ("Test Passed" ) # noqa: EM101
8487 raise ValueError ("Should have been suppressed" ) # noqa: EM101
@@ -91,7 +94,7 @@ async def faulty_coro():
9194 suppress_exceptions = [ValueError ],
9295 exception_delay = 0 ,
9396 exception_limit = 2 ,
94- exception_limit_window = 0.05 ,
97+ exception_limit_window = 0.1 if CI else 0.01 ,
9598 )
9699
97100 with contextlib .suppress (asyncio .CancelledError ), pytest .raises (RuntimeError ):
You can’t perform that action at this time.
0 commit comments