Created
May 4, 2014 16:27
-
-
Save seanjensengrey/d6303c412ed0725d4398 to your computer and use it in GitHub Desktop.
minimal test harness for python (nose like)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import types | |
def test_foo(): | |
assert 1 == 2, '1 must equal 2' | |
def test_bar(): | |
pass | |
if __name__ == "__main__": | |
test_funcs = [] | |
for o in globals().keys(): | |
if o.startswith('test_'): | |
if type(globals()[o]) == types.FunctionType: | |
test_funcs.append(globals()[o]) | |
success = [] | |
failure = [] | |
for tf in test_funcs: | |
try: | |
tf() | |
success.append(tf) | |
except Exception, e: | |
failure.append((tf,e)) | |
print success | |
print failure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment