Improved test architecture #139
This commit is contained in:
parent
75c316f2d2
commit
77d723b9da
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user