You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
980 B
41 lines
980 B
3 years ago
|
#!/usr/bin/python
|
||
|
|
||
|
import unittest
|
||
|
|
||
|
from os.path import dirname, basename, isfile
|
||
|
import glob
|
||
|
|
||
|
# Find all unittest type in this directory and run it.
|
||
|
|
||
|
class RegressTest(unittest.TestCase):
|
||
|
pass
|
||
|
|
||
|
def main():
|
||
|
unittest.main()
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
directory = dirname(__file__)
|
||
|
if directory == '':
|
||
|
directory = '.'
|
||
|
modules = glob.glob(directory+"/*.py")
|
||
|
__all__ = [ basename(f)[:-3] for f in modules if isfile(f)]
|
||
|
suite = unittest.TestSuite()
|
||
|
|
||
|
count = 1
|
||
|
for module in __all__:
|
||
|
if module != "regress":
|
||
|
print("#%u - Adding %s" %(count, module))
|
||
|
count += 1
|
||
|
else:
|
||
|
continue
|
||
|
m = __import__(module)
|
||
|
for cl in dir(m):
|
||
|
try:
|
||
|
realcl = getattr(m,cl)
|
||
|
if issubclass(realcl, unittest.TestCase):
|
||
|
suite.addTest(realcl())
|
||
|
except Exception as e:
|
||
|
pass
|
||
|
|
||
|
unittest.TextTestRunner().run(suite)
|