1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-04 05:28:17 +00:00

test(core): add setUpClass and tearDownClass to core unit tests

[no changelog]
This commit is contained in:
M1nd3r 2024-11-19 12:07:10 +01:00 committed by Petr Sedláček
parent b1f07fec4f
commit 22a7ba7070

View File

@ -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_method(o, name, set_up, tear_down, test_result)
finally:
tear_down_class()
def run_test_method(o, name, set_up, tear_down, test_result):
print(" ", name, end=" ...")
m = getattr(o, name)
try: