kopia lustrzana https://github.com/micropython/micropython-lib
unittest: Add support for setUp() and tearDown().
rodzic
923bbc4d96
commit
bef746c1d0
|
@ -54,11 +54,15 @@ def skipUnless(cond, msg):
|
|||
# TODO: Uncompliant
|
||||
def run_class(c):
|
||||
o = c()
|
||||
set_up = getattr(o, "setUp", lambda: None)
|
||||
tear_down = getattr(o, "tearDown", lambda: None)
|
||||
for name in dir(o):
|
||||
if name.startswith("test"):
|
||||
m = getattr(o, name)
|
||||
try:
|
||||
set_up()
|
||||
m()
|
||||
tear_down()
|
||||
print(name, "...ok")
|
||||
except SkipTest as e:
|
||||
print(name, "...skipped:", e.args[0])
|
||||
|
|
Ładowanie…
Reference in New Issue