File: testall.py

package info (click to toggle)
python-cjkcodecs 1.1.1-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,848 kB
  • ctags: 1,231
  • sloc: ansic: 33,819; python: 2,388; makefile: 70; sh: 11
file content (34 lines) | stat: -rwxr-xr-x 844 bytes parent folder | download
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
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
#
# testall.py
#   Run all unittests.
#
# $Id: testall.py,v 1.3 2004/06/19 06:09:55 perky Exp $

import sys
import os, unittest
from test import test_support

def findtests(testdir='.'):
    tests = []
    for name in os.listdir(testdir):
        if (name.startswith('test_') and name.endswith('.py')
                and not name.endswith('support.py')):
            tests.append(name[:-3])
    return tests

def loadtests(test):
    mod = __import__(test, globals(), locals(), [])
    return unittest.findTestCases(mod)

def main():
    suite = unittest.TestSuite()
    for test in findtests():
        try:
            suite.addTest(loadtests(test))
        except test_support.TestSkipped, msg:
            print "%s - skipped: %s" % (test, msg)
    test_support.run_suite(suite)

if __name__ == '__main__':
    main()