mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-03 13:08:17 +00:00
tests: support async test cases added
- test cases starting with 'test_async' are executed on the async manner
This commit is contained in:
parent
9a5c38dad4
commit
f0b8fcc106
@ -1,4 +1,5 @@
|
|||||||
from trezor.utils import ensure
|
from trezor.utils import ensure
|
||||||
|
from utest import assert_async
|
||||||
|
|
||||||
|
|
||||||
class SkipTest(Exception):
|
class SkipTest(Exception):
|
||||||
@ -178,12 +179,16 @@ def run_class(c, test_result):
|
|||||||
print('class', c.__qualname__)
|
print('class', c.__qualname__)
|
||||||
for name in dir(o):
|
for name in dir(o):
|
||||||
if name.startswith("test"):
|
if name.startswith("test"):
|
||||||
|
is_async = name.startswith("test_async")
|
||||||
print(' ', name, end=' ...')
|
print(' ', name, end=' ...')
|
||||||
m = getattr(o, name)
|
m = getattr(o, name)
|
||||||
try:
|
try:
|
||||||
set_up()
|
set_up()
|
||||||
test_result.testsRun += 1
|
test_result.testsRun += 1
|
||||||
m()
|
if is_async:
|
||||||
|
assert_async(m(), [(None, StopIteration()), ])
|
||||||
|
else:
|
||||||
|
m()
|
||||||
tear_down()
|
tear_down()
|
||||||
print(" ok")
|
print(" ok")
|
||||||
except SkipTest as e:
|
except SkipTest as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user