Commit 44d57774 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Added basic testing framework files.

parents
*.pyc
*.swp
*~
TEST := test.py
test:
@pyrg $(TEST)
clean:
rm `find -name \*.pyc`
.PHONY: test clean
#!/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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment