kopia lustrzana https://github.com/micropython/micropython-lib
unittest: Rewrite .main() to be compliant re: 1st arg.
rodzic
1729f1c7fa
commit
525487137b
|
@ -25,10 +25,12 @@ class TestCase:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
# Warning: this is not compliant, but at least an example of test
|
def main(module="__main__"):
|
||||||
# runner until we have globals()
|
m = __import__(module)
|
||||||
def main(test_classes):
|
for tn in dir(m):
|
||||||
for c in test_classes:
|
c = getattr(m, tn)
|
||||||
|
# workaround for isinstance(c, object) not working
|
||||||
|
if type(c) is type(object) and issubclass(c, TestCase):
|
||||||
o = c()
|
o = c()
|
||||||
for name in dir(o):
|
for name in dir(o):
|
||||||
if name.startswith("test"):
|
if name.startswith("test"):
|
||||||
|
|
Ładowanie…
Reference in New Issue