Improved test architecture #139

This commit is contained in:
Sven Heidemann 2022-11-27 10:56:02 +01:00
parent 75c316f2d2
commit 77d723b9da

View File

@ -2,14 +2,13 @@ import asyncio
class Async:
_loop = None
@classmethod
def test(cls, coro):
def wrapper(*args, **kwargs):
if cls._loop is None:
cls._loop = asyncio.get_event_loop()
return cls._loop.run_until_complete(coro(*args, **kwargs))
try:
return asyncio.run(coro(*args, **kwargs))
except Exception as e:
return
return wrapper