kopia lustrzana https://github.com/micropython/micropython-lib
unittest: Support TestCase subclasses with own runTest() method.
E.g. for doctest. Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>pull/488/head
rodzic
ac282d861e
commit
f92833b015
|
@ -302,11 +302,8 @@ def run_suite(c, test_result):
|
|||
set_up = getattr(o, "setUp", lambda: None)
|
||||
tear_down = getattr(o, "tearDown", lambda: None)
|
||||
exceptions = []
|
||||
for name in dir(o):
|
||||
if name.startswith("test"):
|
||||
m = getattr(o, name)
|
||||
if not callable(m):
|
||||
continue
|
||||
|
||||
def run_one(m):
|
||||
print("%s (%s) ..." % (name, c.__qualname__), end="")
|
||||
set_up()
|
||||
try:
|
||||
|
@ -328,10 +325,21 @@ def run_suite(c, test_result):
|
|||
print(" ERROR")
|
||||
# Uncomment to investigate failure in detail
|
||||
# raise
|
||||
continue
|
||||
finally:
|
||||
tear_down()
|
||||
o.doCleanups()
|
||||
|
||||
if hasattr(o, "runTest"):
|
||||
name = str(o)
|
||||
run_one(o.runTest)
|
||||
return
|
||||
|
||||
for name in dir(o):
|
||||
if name.startswith("test"):
|
||||
m = getattr(o, name)
|
||||
if not callable(m):
|
||||
continue
|
||||
run_one(m)
|
||||
return exceptions
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue