Fix atag slow tests (#64567)

* Fix atag slow tests

* Fix sleep fixture
This commit is contained in:
Shay Levy 2022-01-20 22:23:08 +02:00 committed by GitHub
parent a9785f1b41
commit 62c55e6698
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,17 @@
"""Provide common Atag fixtures."""
import asyncio
from unittest.mock import patch
import pytest
@pytest.fixture(autouse=True)
async def mock_pyatag_sleep():
"""Mock out pyatag sleeps."""
asyncio_sleep = asyncio.sleep
async def sleep(duration, loop=None):
await asyncio_sleep(0)
with patch("pyatag.gateway.asyncio.sleep", new=sleep):
yield