unittest: Add simple, non-compliant test runner.

Need to implement importing of __main__ module and/or globals() to write
compliant implementation.
asyncio-segfault
Paul Sokolovsky 2014-04-04 12:09:18 +03:00
rodzic 27ec4eb700
commit 1729f1c7fa
1 zmienionych plików z 12 dodań i 0 usunięć

Wyświetl plik

@ -23,3 +23,15 @@ class TestCase:
if isinstance(e, exc):
return
raise
# Warning: this is not compliant, but at least an example of test
# runner until we have globals()
def main(test_classes):
for c in test_classes:
o = c()
for name in dir(o):
if name.startswith("test"):
m = getattr(o, name)
m()
print(name, "...ok")