Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a test runner that runs all the tests in the test/ directory.
- Loading branch information
Toru Maesaka
committed
Apr 3, 2011
1 parent
0195fb1
commit fe3e7e4
Showing
2 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Copyright 2011, Toru Maesaka | ||
# | ||
# Redistribution and use of this source code is licensed under | ||
# the BSD license. See COPYING file for license description. | ||
|
||
import os | ||
import re | ||
import unittest | ||
|
||
_TEST_MODULE_PATTERN = re.compile(r'^(t_.+)\.py$') | ||
|
||
def _run_all_tests(): | ||
module_names = [] | ||
loader = unittest.TestLoader() | ||
test_path = os.path.join(os.path.split(__file__)[0], '.') | ||
|
||
for filename in os.listdir(test_path): | ||
match = _TEST_MODULE_PATTERN.search(filename) | ||
if match: | ||
module_names.append(match.group(1)) | ||
|
||
return loader.loadTestsFromNames(module_names) | ||
|
||
if __name__ == '__main__': | ||
unittest.main(defaultTest='_run_all_tests') | ||
pass |
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