From: Chris Lamb Date: Sun, 9 Aug 2009 12:07:50 +0000 (+0100) Subject: Add a basic test runner. X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=30973455d4ca79d0d08a0ccce42c4a22722688ed;p=dak.git Add a basic test runner. --- diff --git a/tests/test_all.py b/tests/test_all.py new file mode 100755 index 00000000..32e58aba --- /dev/null +++ b/tests/test_all.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import unittest + +def suite(): + suite = unittest.TestSuite() + for _, _, files in os.walk('.'): + for name in filter(is_test, files): + tests = unittest.defaultTestLoader.loadTestsFromName(name[:-3]) + suite.addTests(tests) + return suite + +def is_test(filename): + return filename.startswith('test_') and filename.endswith('.py') + +if __name__ == "__main__": + unittest.main(defaultTest="suite")