Created
June 25, 2015 22:03
-
-
Save davidallsopp/e45bd14fb82ea353515b to your computer and use it in GitHub Desktop.
Ultra-simple test harness for Python. Locates all functions in the current module that start with "test", and runs them.
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
def test_example(): | |
assert False, "A failing test" | |
if __name__ == "__main__": | |
tests = [(k, v) for k, v in locals().items() if k.startswith("test")] | |
print("%s TESTS FOUND" % len(tests)) | |
for k, v in tests: | |
print(k) | |
v() | |
print("TESTS COMPLETE") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment