mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-04 13:38:28 +00:00
test(core): add setUpClass and tearDownClass to core unit tests
[no changelog]
This commit is contained in:
parent
b1f07fec4f
commit
22a7ba7070
@ -236,11 +236,21 @@ generator_type = type((lambda: (yield))())
|
|||||||
|
|
||||||
def run_class(c, test_result):
|
def run_class(c, test_result):
|
||||||
o = c()
|
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)
|
set_up = getattr(o, "setUp", lambda: None)
|
||||||
tear_down = getattr(o, "tearDown", lambda: None)
|
tear_down = getattr(o, "tearDown", lambda: None)
|
||||||
print("class", c.__qualname__)
|
print("class", c.__qualname__)
|
||||||
|
try:
|
||||||
|
set_up_class()
|
||||||
for name in dir(o):
|
for name in dir(o):
|
||||||
if name.startswith("test"):
|
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=" ...")
|
print(" ", name, end=" ...")
|
||||||
m = getattr(o, name)
|
m = getattr(o, name)
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user