Skip to content
Snippets Groups Projects
Commit 44d57774 authored by Taddeüs Kroes's avatar Taddeüs Kroes
Browse files

Added basic testing framework files.

parents
No related branches found
No related tags found
No related merge requests found
*.pyc
*.swp
*~
TEST := test.py
test:
@pyrg $(TEST)
clean:
rm `find -name \*.pyc`
.PHONY: test clean
test.py 0 → 100755
#!/usr/bin/env python
import os
import re
import sys
import unittest
TESTS_DIR = 'tests'
matches = [re.match('^(test_(\w+)).\py$', f) for f in os.listdir(TESTS_DIR)]
suite = unittest.TestSuite()
loader = unittest.TestLoader()
for match in filter(None, matches):
modulename, testname = match.groups()
classname = re.sub('(?:^|_)([a-z])', lambda m: m.group(1).upper(),
testname) + 'Test'
mod = __import__(TESTS_DIR + '.' + modulename, globals(), locals(),
classname)
suite.addTests(loader.loadTestsFromTestCase(getattr(mod, classname)))
unittest.TextTestRunner().run(suite)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment