mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-04 04:00:18 +03:00
Stop using the event_loop fixture
pytest-asyncio has deprecated (and in 1.0, removed) the event_loop fixture, which is only used for one testcase. Use the get_running_loop() helper function instead.
This commit is contained in:
parent
d80898ecc5
commit
8e2a46568e
|
@ -39,9 +39,9 @@ def test_strip_text():
|
||||||
|
|
||||||
class TestSyncifyAsyncContext:
|
class TestSyncifyAsyncContext:
|
||||||
class NoopContextManager:
|
class NoopContextManager:
|
||||||
def __init__(self, loop):
|
def __init__(self):
|
||||||
self.count = 0
|
self.count = 0
|
||||||
self.loop = loop
|
self.loop = helpers.get_running_loop()
|
||||||
|
|
||||||
async def __aenter__(self):
|
async def __aenter__(self):
|
||||||
self.count += 1
|
self.count += 1
|
||||||
|
@ -54,8 +54,8 @@ class TestSyncifyAsyncContext:
|
||||||
__enter__ = helpers._sync_enter
|
__enter__ = helpers._sync_enter
|
||||||
__exit__ = helpers._sync_exit
|
__exit__ = helpers._sync_exit
|
||||||
|
|
||||||
def test_sync_acontext(self, event_loop):
|
def test_sync_acontext(self):
|
||||||
contm = self.NoopContextManager(event_loop)
|
contm = self.NoopContextManager()
|
||||||
assert contm.count == 0
|
assert contm.count == 0
|
||||||
|
|
||||||
with contm:
|
with contm:
|
||||||
|
@ -64,8 +64,8 @@ class TestSyncifyAsyncContext:
|
||||||
assert contm.count == 0
|
assert contm.count == 0
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_async_acontext(self, event_loop):
|
async def test_async_acontext(self):
|
||||||
contm = self.NoopContextManager(event_loop)
|
contm = self.NoopContextManager()
|
||||||
assert contm.count == 0
|
assert contm.count == 0
|
||||||
|
|
||||||
async with contm:
|
async with contm:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user