Use find_tests() for library.test_cli as well

This commit is contained in:
Kovid Goyal 2016-12-05 19:00:00 +05:30
parent 5299c936e5
commit 1ff4f01b39
2 changed files with 8 additions and 1 deletions

View File

@ -10,9 +10,11 @@ from setup import Command
TEST_MODULES = frozenset('srv db polish opf css docx cfi matcher icu smartypants build misc library'.split())
def find_tests(which_tests=None):
ans = []
a = ans.append
def ok(x):
return not which_tests or x in which_tests
@ -65,7 +67,8 @@ def find_tests(which_tests=None):
from calibre.utils.shared_file import find_tests
a(find_tests())
if ok('library'):
a(unittest.TestLoader().discover('src/calibre/library'))
from calibre.library.test_cli import find_tests
a(find_tests())
tests = unittest.TestSuite(ans)
return tests

View File

@ -98,3 +98,7 @@ class PrintCheckLibraryResultsTest(unittest.TestCase):
result = mock_stdout.getvalue().split('\n')
parsed_result = [l for l in csv.reader(result) if l]
self.assertEqual(parsed_result, [[self.check_human_name, data[0][0], data[0][1]]])
def find_tests():
return unittest.defaultTestLoader.loadTestsFromTestCase(PrintCheckLibraryResultsTest)