Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eventloop get stuck when VirtualClock used with real timestamps #69

Open
KholdStare opened this issue Mar 4, 2024 · 0 comments
Open

Comments

@KholdStare
Copy link

When using real timestamps for like 1709591365, the python event loop gets stuck forever in await:

import pytest
import asyncio
from aiotools import VirtualClock

@pytest.mark.asyncio
async def test_stuck_forever():
  clock = VirtualClock()
  clock.vtime = 1709591365
  with lock.patch_loop():
    await asyncio.sleep(1)

This is due to a behavior (bug?) in the BaseEventLoop python/cpython#116342 .

The way I was able to solve it, was to override the eventloop _clock_resolution to 0.1 . Perhaps this should be added to the patch_loop implementation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant