Skip to content

Commit 8cd2a73

Browse files
authored
Python: replace asyncio.sleep with anyio.sleep in async tests (#4682)
fix: replace asyncio.sleep with anyio.sleep in async tests Fixes RuntimeError: no running event loop by using anyio.sleep() instead of asyncio.sleep() in test_async_client.py test cases. Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
1 parent 5094aa4 commit 8cd2a73

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

python/tests/async_tests/test_async_client.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11238,10 +11238,7 @@ async def test_hexpire(self, glide_client: TGlideClient):
1123811238
result = await glide_client.hexpire(key, 1, [field1]) # 1 second
1123911239
assert result == [1] # Should set expiration
1124011240

11241-
# Wait a moment and check if it's still there or expired
11242-
import asyncio
11243-
11244-
await asyncio.sleep(0.1) # Small delay
11241+
await anyio.sleep(0.1) # Small delay
1124511242
ttl_result = await glide_client.httl(key, [field1])
1124611243
assert (
1124711244
ttl_result[0] == 1 or ttl_result[0] == -2
@@ -11411,9 +11408,7 @@ async def test_hpexpire(self, glide_client: TGlideClient):
1141111408
assert result == [1] # Should set expiration
1141211409

1141311410
# Wait a moment and check if it's still there or expired
11414-
import asyncio
11415-
11416-
await asyncio.sleep(0.1) # Small delay
11411+
await anyio.sleep(0.1) # Small delay
1141711412
ttl_result = await glide_client.httl(key, [field1])
1141811413
assert (
1141911414
ttl_result[0] == 1 or ttl_result[0] == -2

0 commit comments

Comments
 (0)