1 #
2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
3 # This module is free software, and you may redistribute it and/or modify
4 # under the same terms as Python, so long as this copyright message and
5 # disclaimer are retained in their original form.
6 #
7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
10 # POSSIBILITY OF SUCH DAMAGE.
11 #
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 #
18 # $Id: test_sqlite.py,v 1.6 2008-09-01 00:43:02 richard Exp $
20 import unittest, os, shutil, time
21 from roundup.backends import get_backend, have_backend
23 from db_test_base import DBTest, ROTest, SchemaTest, ClassicInitTest, config
24 from db_test_base import ConcurrentDBTest, FilterCacheTest
26 class sqliteOpener:
27 if have_backend('sqlite'):
28 module = get_backend('sqlite')
30 def nuke_database(self):
31 shutil.rmtree(config.DATABASE)
33 class sqliteDBTest(sqliteOpener, DBTest):
34 pass
36 class sqliteROTest(sqliteOpener, ROTest):
37 pass
39 class sqliteSchemaTest(sqliteOpener, SchemaTest):
40 pass
42 class sqliteClassicInitTest(ClassicInitTest):
43 backend = 'sqlite'
45 class sqliteConcurrencyTest(ConcurrentDBTest):
46 backend = 'sqlite'
48 class sqliteFilterCacheTest(sqliteOpener, FilterCacheTest):
49 backend = 'sqlite'
51 from session_common import RDBMSTest
52 class sqliteSessionTest(sqliteOpener, RDBMSTest):
53 pass
55 def test_suite():
56 suite = unittest.TestSuite()
57 from roundup import backends
58 if not have_backend('sqlite'):
59 print 'Skipping sqlite tests'
60 return suite
61 print 'Including sqlite tests'
62 suite.addTest(unittest.makeSuite(sqliteDBTest))
63 suite.addTest(unittest.makeSuite(sqliteROTest))
64 suite.addTest(unittest.makeSuite(sqliteSchemaTest))
65 suite.addTest(unittest.makeSuite(sqliteClassicInitTest))
66 suite.addTest(unittest.makeSuite(sqliteSessionTest))
67 suite.addTest(unittest.makeSuite(sqliteConcurrencyTest))
68 suite.addTest(unittest.makeSuite(sqliteFilterCacheTest))
69 return suite
71 if __name__ == '__main__':
72 runner = unittest.TextTestRunner()
73 unittest.main(testRunner=runner)