mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-07 14:00:57 +00:00
test(core): add setUpClass and tearDownClass to core unit tests
[no changelog]
This commit is contained in:
parent
933c568e32
commit
63c61b42d6
@ -236,11 +236,21 @@ generator_type = type((lambda: (yield))())
|
||||
|
||||
def run_class(c, test_result):
|
||||
o = c()
|
||||
set_up_class = getattr(o, "setUpClass", lambda: None)
|
||||
tear_down_class = getattr(o, "tearDownClass", lambda: None)
|
||||
set_up = getattr(o, "setUp", lambda: None)
|
||||
tear_down = getattr(o, "tearDown", lambda: None)
|
||||
print("class", c.__qualname__)
|
||||
try:
|
||||
set_up_class()
|
||||
for name in dir(o):
|
||||
if name.startswith("test"):
|
||||
run_test(o, name, set_up, tear_down, test_result)
|
||||
finally:
|
||||
tear_down_class()
|
||||
|
||||
|
||||
def run_test(o, name, set_up, tear_down, test_result):
|
||||
print(" ", name, end=" ...")
|
||||
m = getattr(o, name)
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user