blob: 409ad97c917ed7d12f9e64104b30583737a1a971 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
"""Run all unit tests."""
import glob
import os
import sys
if sys.version_info[:2] < (2, 7):
import unittest2 as unittest
else:
import unittest
def main():
test_dir = os.path.dirname(os.path.abspath(__file__))
test_files = glob.glob(os.path.join(test_dir, 'test_*.py'))
test_names = [os.path.basename(f)[:-3] for f in test_files]
sys.path.insert(0, os.path.join(test_dir, '..'))
suite = unittest.defaultTestLoader.loadTestsFromNames(test_names)
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(1 if (result.errors or result.failures) else 0)
if __name__ == '__main__':
main()
|