comparison test/test_db.py @ 431:a28a80b714f9

Eliminate database close method by using weakrefs. . We now use weakrefs in the Classes to keep the database reference, so the close() method on the database is no longer needed. I bumped the minimum python requirement up to 2.1 accordingly. . [SF#487480] roundup-server . [SF#487476] INSTALL.txt I also cleaned up the change message / post-edit stuff in the cgi client. There's now a clearly marked "TODO: append the change note" where I believe the change note should be added there. The "changes" list will obviously have to be modified to be a dict of the changes, or somesuch. More testing needed.
author Richard Jones <richard@users.sourceforge.net>
date Sun, 02 Dec 2001 05:06:16 +0000
parents a4241ddd22d7
children f97415cccb9d
comparison
equal deleted inserted replaced
430:350685601f37 431:a28a80b714f9
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_db.py,v 1.8 2001-10-09 07:25:59 richard Exp $ 18 # $Id: test_db.py,v 1.9 2001-12-02 05:06:16 richard Exp $
19 19
20 import unittest, os, shutil 20 import unittest, os, shutil
21 21
22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \
23 Interval, Class, DatabaseError 23 Interval, Class, DatabaseError
48 class MyTestCase(unittest.TestCase): 48 class MyTestCase(unittest.TestCase):
49 # def defaultTestResult(self): 49 # def defaultTestResult(self):
50 # return MyTestResult() 50 # return MyTestResult()
51 def tearDown(self): 51 def tearDown(self):
52 if self.db is not None: 52 if self.db is not None:
53 self.db.close()
54 shutil.rmtree('_test_dir') 53 shutil.rmtree('_test_dir')
55 54
56 class DBTestCase(MyTestCase): 55 class DBTestCase(MyTestCase):
57 def setUp(self): 56 def setUp(self):
58 from roundup.backends import anydbm 57 from roundup.backends import anydbm
156 if os.path.exists('_test_dir'): 155 if os.path.exists('_test_dir'):
157 shutil.rmtree('_test_dir') 156 shutil.rmtree('_test_dir')
158 os.mkdir('_test_dir') 157 os.mkdir('_test_dir')
159 db = anydbm.Database('_test_dir', 'test') 158 db = anydbm.Database('_test_dir', 'test')
160 setupSchema(db, 1) 159 setupSchema(db, 1)
161 db.close()
162 self.db = anydbm.Database('_test_dir') 160 self.db = anydbm.Database('_test_dir')
163 setupSchema(self.db, 0) 161 setupSchema(self.db, 0)
164 162
165 def testExceptions(self): 163 def testExceptions(self):
166 # this tests the exceptions that should be raised 164 # this tests the exceptions that should be raised
189 if os.path.exists('_test_dir'): 187 if os.path.exists('_test_dir'):
190 shutil.rmtree('_test_dir') 188 shutil.rmtree('_test_dir')
191 os.mkdir('_test_dir') 189 os.mkdir('_test_dir')
192 db = bsddb.Database('_test_dir', 'test') 190 db = bsddb.Database('_test_dir', 'test')
193 setupSchema(db, 1) 191 setupSchema(db, 1)
194 db.close()
195 self.db = bsddb.Database('_test_dir') 192 self.db = bsddb.Database('_test_dir')
196 setupSchema(self.db, 0) 193 setupSchema(self.db, 0)
197 194
198 195
199 class bsddb3DBTestCase(DBTestCase): 196 class bsddb3DBTestCase(DBTestCase):
213 if os.path.exists('_test_dir'): 210 if os.path.exists('_test_dir'):
214 shutil.rmtree('_test_dir') 211 shutil.rmtree('_test_dir')
215 os.mkdir('_test_dir') 212 os.mkdir('_test_dir')
216 db = bsddb3.Database('_test_dir', 'test') 213 db = bsddb3.Database('_test_dir', 'test')
217 setupSchema(db, 1) 214 setupSchema(db, 1)
218 db.close()
219 self.db = bsddb3.Database('_test_dir') 215 self.db = bsddb3.Database('_test_dir')
220 setupSchema(self.db, 0) 216 setupSchema(self.db, 0)
221 217
222 218
223 def suite(): 219 def suite():
240 236
241 return unittest.TestSuite(l) 237 return unittest.TestSuite(l)
242 238
243 # 239 #
244 # $Log: not supported by cvs2svn $ 240 # $Log: not supported by cvs2svn $
241 # Revision 1.8 2001/10/09 07:25:59 richard
242 # Added the Password property type. See "pydoc roundup.password" for
243 # implementation details. Have updated some of the documentation too.
244 #
245 # Revision 1.7 2001/08/29 06:23:59 richard 245 # Revision 1.7 2001/08/29 06:23:59 richard
246 # Disabled the bsddb3 module entirely in the unit testing. See CHANGES for 246 # Disabled the bsddb3 module entirely in the unit testing. See CHANGES for
247 # details. 247 # details.
248 # 248 #
249 # Revision 1.6 2001/08/07 00:24:43 richard 249 # Revision 1.6 2001/08/07 00:24:43 richard

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