comparison test/db_test_base.py @ 2754:1f89984c0ea5

testJournals: if backend is too fast, two journal entries... ...may come at the same millisecond. as a result, journal is sorted in wrong order and the test fails although functionality being tested is ok. add small delay to work around this - journaled actions rarely occur as frequent in the real life.
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Thu, 14 Oct 2004 10:47:07 +0000
parents d8eb00a54119
children da2a9175eb83
comparison
equal deleted inserted replaced
2753:d8eb00a54119 2754:1f89984c0ea5
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: db_test_base.py,v 1.49 2004-10-14 10:39:14 a1s Exp $ 18 # $Id: db_test_base.py,v 1.50 2004-10-14 10:47:07 a1s Exp $
19 19
20 import unittest, os, shutil, errno, imp, sys, time, pprint 20 import unittest, os, shutil, errno, imp, sys, time, pprint
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, Node 23 Interval, DatabaseError, Boolean, Number, Node
594 self.assertEqual('1', nodeid) 594 self.assertEqual('1', nodeid)
595 self.assertEqual('1', journaltag) 595 self.assertEqual('1', journaltag)
596 self.assertEqual('link', action) 596 self.assertEqual('link', action)
597 self.assertEqual(('issue', '1', 'assignedto'), params) 597 self.assertEqual(('issue', '1', 'assignedto'), params)
598 598
599 # wait a bit to keep proper order of journal entries
600 time.sleep(0.01)
599 # journal entry for unlink 601 # journal entry for unlink
600 self.db.issue.set('1', assignedto='2') 602 self.db.issue.set('1', assignedto='2')
601 self.db.commit() 603 self.db.commit()
602 journal = self.db.getjournal('user', '1') 604 journal = self.db.getjournal('user', '1')
603 self.assertEqual(3, len(journal)) 605 self.assertEqual(3, len(journal))

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