comparison test/test_init.py @ 1922:84b6d5b07626 maint-0.6

testing fixes for mysql, backported from HEAD
author Richard Jones <richard@users.sourceforge.net>
date Fri, 14 Nov 2003 02:47:56 +0000
parents 4074e2336eed
children
comparison
equal deleted inserted replaced
1921:4ad75ca452d9 1922:84b6d5b07626
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 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" 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, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
18 # $Id: test_init.py,v 1.23 2003-04-17 06:51:44 richard Exp $ 18 # $Id: test_init.py,v 1.23.2.1 2003-11-14 02:47:56 richard Exp $
19 19
20 import unittest, os, shutil, errno, imp, sys 20 import unittest, os, shutil, errno, imp, sys
21 21
22 from roundup import init 22 from roundup import init
23 23
37 except OSError, error: 37 except OSError, error:
38 if error.errno not in (errno.ENOENT, errno.ESRCH): raise 38 if error.errno not in (errno.ENOENT, errno.ESRCH): raise
39 39
40 class ClassicTestCase(MyTestCase): 40 class ClassicTestCase(MyTestCase):
41 backend = 'anydbm' 41 backend = 'anydbm'
42 extra_config = ''
42 def testCreation(self): 43 def testCreation(self):
43 ae = self.assertEqual 44 ae = self.assertEqual
44 45
45 # create the instance 46 # create the instance
46 init.install(self.dirname, 'templates/classic') 47 init.install(self.dirname, 'templates/classic')
47 init.write_select_db(self.dirname, self.backend) 48 init.write_select_db(self.dirname, self.backend)
49
50 if self.extra_config:
51 f = open(os.path.join(self.dirname, 'config.py'), 'a')
52 try:
53 f.write(self.extra_config)
54 finally:
55 f.close()
56
48 init.initialise(self.dirname, 'sekrit') 57 init.initialise(self.dirname, 'sekrit')
49 58
50 # check we can load the package 59 # check we can load the package
51 instance = imp.load_package(self.dirname, self.dirname) 60 instance = imp.load_package(self.dirname, self.dirname)
52 61
76 backend = 'bsddb3' 85 backend = 'bsddb3'
77 86
78 class metakitClassicTestCase(ClassicTestCase): 87 class metakitClassicTestCase(ClassicTestCase):
79 backend = 'metakit' 88 backend = 'metakit'
80 89
81 class mysqlClassicTestCase(ClassicTestCase):
82 backend = 'mysql'
83
84 class sqliteClassicTestCase(ClassicTestCase): 90 class sqliteClassicTestCase(ClassicTestCase):
85 backend = 'sqlite' 91 backend = 'sqlite'
86 92
87 def suite(): 93 def suite():
88 l = [ 94 l = [
94 l.append(unittest.makeSuite(bsddbClassicTestCase, 'test')) 100 l.append(unittest.makeSuite(bsddbClassicTestCase, 'test'))
95 if hasattr(backends, 'bsddb3'): 101 if hasattr(backends, 'bsddb3'):
96 l.append(unittest.makeSuite(bsddb3ClassicTestCase, 'test')) 102 l.append(unittest.makeSuite(bsddb3ClassicTestCase, 'test'))
97 if hasattr(backends, 'metakit'): 103 if hasattr(backends, 'metakit'):
98 l.append(unittest.makeSuite(metakitClassicTestCase, 'test')) 104 l.append(unittest.makeSuite(metakitClassicTestCase, 'test'))
99 if hasattr(backends, 'mysql'):
100 l.append(unittest.makeSuite(mysqlClassicTestCase, 'test'))
101 if hasattr(backends, 'sqlite'): 105 if hasattr(backends, 'sqlite'):
102 l.append(unittest.makeSuite(sqliteClassicTestCase, 'test')) 106 l.append(unittest.makeSuite(sqliteClassicTestCase, 'test'))
103 107
104 return unittest.TestSuite(l) 108 return unittest.TestSuite(l)
105 109

Roundup Issue Tracker: http://roundup-tracker.org/