comparison test/test_db.py @ 1183:08a13a84ed43

Some speedups - both of the SQL backends can handle using only one cursor. Better date unserialisation too.
author Richard Jones <richard@users.sourceforge.net>
date Mon, 23 Sep 2002 06:48:35 +0000
parents 18bb36e4f62f
children 1c5bc0e2ed7d
comparison
equal deleted inserted replaced
1182:cb35cf3db0e0 1183:08a13a84ed43
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.53 2002-09-20 19:26:28 gmcm Exp $ 18 # $Id: test_db.py,v 1.54 2002-09-23 06:48:35 richard Exp $
19 19
20 import unittest, os, shutil, time 20 import unittest, os, shutil, time
21 21
22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \
23 Interval, DatabaseError, Boolean, Number 23 Interval, DatabaseError, Boolean, Number
411 self.db.commit() 411 self.db.commit()
412 entry = self.db.getjournal('issue', '1')[-1] 412 entry = self.db.getjournal('issue', '1')[-1]
413 (x, date_stamp2, x, x, x) = entry 413 (x, date_stamp2, x, x, x) = entry
414 # see if the change was journalled when it shouldn't have been 414 # see if the change was journalled when it shouldn't have been
415 self.assertEqual(date_stamp, date_stamp2) 415 self.assertEqual(date_stamp, date_stamp2)
416 time.sleep(1)
416 self.db.issue.enableJournalling() 417 self.db.issue.enableJournalling()
417 self.db.issue.set('1', title='hello world 2') 418 self.db.issue.set('1', title='hello world 2')
418 self.db.commit() 419 self.db.commit()
419 entry = self.db.getjournal('issue', '1')[-1] 420 entry = self.db.getjournal('issue', '1')[-1]
420 (x, date_stamp2, x, x, x) = entry 421 (x, date_stamp2, x, x, x) = entry
426 self.db.commit() 427 self.db.commit()
427 self.db.issue.set(id, status='2') 428 self.db.issue.set(id, status='2')
428 self.db.commit() 429 self.db.commit()
429 430
430 # sleep for at least a second, then get a date to pack at 431 # sleep for at least a second, then get a date to pack at
431 time.sleep(1) 432 time.sleep(2)
432 pack_before = date.Date('.') 433 pack_before = date.Date('.')
433 time.sleep(1) 434 time.sleep(2)
434 435
435 # one more entry 436 # one more entry
436 self.db.issue.set(id, status='3') 437 self.db.issue.set(id, status='3')
437 self.db.commit() 438 self.db.commit()
438 439
716 def suite(): 717 def suite():
717 l = [ 718 l = [
718 unittest.makeSuite(anydbmDBTestCase, 'test'), 719 unittest.makeSuite(anydbmDBTestCase, 'test'),
719 unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test') 720 unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test')
720 ] 721 ]
721 # return unittest.TestSuite(l) 722 return unittest.TestSuite(l)
722 723
723 try: 724 try:
724 import gadfly 725 import gadfly
725 l.append(unittest.makeSuite(gadflyDBTestCase, 'test')) 726 l.append(unittest.makeSuite(gadflyDBTestCase, 'test'))
726 l.append(unittest.makeSuite(gadflyReadOnlyDBTestCase, 'test')) 727 l.append(unittest.makeSuite(gadflyReadOnlyDBTestCase, 'test'))

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