File: run_tests

package info (click to toggle)
python-webunit 1%3A1.3.10-2.1
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 172 kB
  • ctags: 209
  • sloc: python: 1,516; makefile: 9
file content (22 lines) | stat: -rwxr-xr-x 701 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#! /usr/bin/env python

import unittest, sys, types

class TestLoader(unittest.TestLoader):
    def loadTestsFromModule(self, module):
        '''Override so we can use suites already defined in the modules
	'''
        tests = []
        if hasattr(module, 'suite'):
            return module.suite()
        for name in dir(module):
            obj = getattr(module, name)
            if type(obj) == types.ClassType and issubclass(obj, TestCase):
                tests.append(self.loadTestsFromTestCase(obj))
        return self.suiteClass(tests)

if __name__ == '__main__':
    unittest.TestProgram(module=None, argv=sys.argv, testLoader=TestLoader())


# vim: set filetype=python ts=4 sw=4 et si