Code

Forward-porting of fixes from the maintenance branch.
[roundup.git] / test / test_sqlite.py
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.3 2003-11-14 00:11:19 richard Exp $ 
20 import unittest, os, shutil, time
22 from db_test_base import DBTest, ROTest, SchemaTest, ClassicInitTest, config
24 class sqliteOpener:
25     from roundup import backends
26     if hasattr(backends, 'sqlite'):
27         from roundup.backends import sqlite as module
29     def nuke_database(self):
30         shutil.rmtree(config.DATABASE)
32 class sqliteDBTest(sqliteOpener, DBTest):
33     pass
35 class sqliteROTest(sqliteOpener, ROTest):
36     pass
38 class sqliteSchemaTest(sqliteOpener, SchemaTest):
39     pass
41 class sqliteClassicInitTest(ClassicInitTest):
42     backend = 'sqlite'
44 def test_suite():
45     suite = unittest.TestSuite()
46     from roundup import backends
47     if not hasattr(backends, 'sqlite'):
48         print 'Skipping sqlite tests'
49         return suite
50     print 'Including sqlite tests'
51     suite.addTest(unittest.makeSuite(sqliteDBTest))
52     suite.addTest(unittest.makeSuite(sqliteROTest))
53     suite.addTest(unittest.makeSuite(sqliteSchemaTest))
54     suite.addTest(unittest.makeSuite(sqliteClassicInitTest))
55     return suite
57 if __name__ == '__main__':
58     runner = unittest.TextTestRunner()
59     unittest.main(testRunner=runner)