mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Run calibre.library tests
- follow convention, add a find_tests, tests method to calibre.library.test. Add calibre.library to the list in setup/test.py - sort some imports - add .cache to .gitignore
This commit is contained in:
parent
cc0d25c123
commit
8522ac55af
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,6 +5,7 @@
|
||||
.bzr
|
||||
.bzrignore
|
||||
.build-cache
|
||||
.cache
|
||||
src/calibre/plugins
|
||||
resources/images.qrc
|
||||
manual/generated
|
||||
|
@ -8,7 +8,7 @@ import unittest
|
||||
|
||||
from setup import Command
|
||||
|
||||
TEST_MODULES = frozenset('srv db polish opf css docx cfi matcher icu smartypants build misc'.split())
|
||||
TEST_MODULES = frozenset('srv db polish opf css docx cfi matcher icu smartypants build misc library'.split())
|
||||
|
||||
def find_tests(which_tests=None):
|
||||
ans = []
|
||||
@ -64,6 +64,9 @@ def find_tests(which_tests=None):
|
||||
a(find_tests())
|
||||
from calibre.utils.shared_file import find_tests
|
||||
a(find_tests())
|
||||
if ok('library'):
|
||||
from calibre.library.test import find_tests
|
||||
a(find_tests())
|
||||
|
||||
tests = unittest.TestSuite(ans)
|
||||
return tests
|
||||
|
@ -10,10 +10,10 @@ Unit tests for database layer.
|
||||
import sys, unittest, os, cStringIO
|
||||
from itertools import repeat
|
||||
|
||||
from calibre.ptempfile import PersistentTemporaryDirectory
|
||||
from calibre.library.database2 import LibraryDatabase2
|
||||
from calibre.ebooks.metadata import MetaInformation
|
||||
|
||||
from calibre.library.database2 import LibraryDatabase2
|
||||
from calibre.ptempfile import PersistentTemporaryDirectory
|
||||
from calibre.utils.run_tests import find_tests_in_dir, run_tests
|
||||
|
||||
class DBTest(unittest.TestCase):
|
||||
|
||||
@ -89,12 +89,13 @@ class DBTest(unittest.TestCase):
|
||||
self.assertEqual(self.db.rating(0), 3)
|
||||
|
||||
|
||||
def suite():
|
||||
return unittest.TestLoader().loadTestsFromTestCase(DBTest)
|
||||
def find_tests():
|
||||
base = os.path.dirname(os.path.abspath(__file__))
|
||||
return find_tests_in_dir(base)
|
||||
|
||||
|
||||
def test():
|
||||
unittest.TextTestRunner(verbosity=2).run(suite())
|
||||
run_tests(find_tests())
|
||||
|
||||
|
||||
def main(args=sys.argv):
|
||||
|
Loading…
x
Reference in New Issue
Block a user