Premiere version : mise en route du suivi.
[auf_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.6 2008-09-01 00:43:02 richard Exp $
19
20 import unittest, os, shutil, time
21 from roundup.backends import get_backend, have_backend
22
23 from db_test_base import DBTest, ROTest, SchemaTest, ClassicInitTest, config
24
25 class sqliteOpener:
26 if have_backend('sqlite'):
27 module = get_backend('sqlite')
28
29 def nuke_database(self):
30 shutil.rmtree(config.DATABASE)
31
32 class sqliteDBTest(sqliteOpener, DBTest):
33 pass
34
35 class sqliteROTest(sqliteOpener, ROTest):
36 pass
37
38 class sqliteSchemaTest(sqliteOpener, SchemaTest):
39 pass
40
41 class sqliteClassicInitTest(ClassicInitTest):
42 backend = 'sqlite'
43
44 from session_common import RDBMSTest
45 class sqliteSessionTest(sqliteOpener, RDBMSTest):
46 pass
47
48 def test_suite():
49 suite = unittest.TestSuite()
50 from roundup import backends
51 if not have_backend('sqlite'):
52 print 'Skipping sqlite tests'
53 return suite
54 print 'Including sqlite tests'
55 suite.addTest(unittest.makeSuite(sqliteDBTest))
56 suite.addTest(unittest.makeSuite(sqliteROTest))
57 suite.addTest(unittest.makeSuite(sqliteSchemaTest))
58 suite.addTest(unittest.makeSuite(sqliteClassicInitTest))
59 suite.addTest(unittest.makeSuite(sqliteSessionTest))
60 return suite
61
62 if __name__ == '__main__':
63 runner = unittest.TextTestRunner()
64 unittest.main(testRunner=runner)
65