forked from bookfere/Ebook-Translator-Calibre-Plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
28 lines (21 loc) · 820 Bytes
/
test.py
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
import sys
import unittest
from pkgutil import iter_modules
from importlib import import_module
# from calibre.utils.run_tests import run_cli
def get_tests(module):
return unittest.defaultTestLoader.loadTestsFromModule(module)
def get_test_suite():
suite = unittest.TestSuite()
for module in iter_modules(['tests']):
module = import_module(
'calibre_plugins.ebook_translator.tests.%s' % module.name)
suite.addTests(get_tests(module))
return suite
if __name__ == '__main__':
args = sys.argv[1:]
patterns = None if len(args) < 1 else ['*%s' % p for p in args]
unittest.defaultTestLoader.testNamePatterns = patterns
runner = unittest.TextTestRunner(verbosity=1, failfast=True)
runner.run(get_test_suite())
# run_cli(get_test_suite(), buffer=False)