Mercurial > p > roundup > code
diff test/db_test_base.py @ 6968:4169f27f15f6
force time offset when loading journal
Had a failure in python2.7 under sqlite where journal
was in wrong location because two journal entries had
identical timestamps.
jonural entry 2 and 3 were swapped. Add a second offset to
all new journal entries added to see if we can prevent this..
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 13 Sep 2022 18:40:43 -0400 |
| parents | 9ff091537f43 |
| children | 2acea75cd7e5 |
line wrap: on
line diff
--- a/test/db_test_base.py Tue Sep 13 17:42:32 2022 -0400 +++ b/test/db_test_base.py Tue Sep 13 18:40:43 2022 -0400 @@ -1432,18 +1432,19 @@ self.db.commit() journal = self.db.getjournal('issue', id) now = date.Date('.') - sec = date.Interval('0:00:01') + sec1 = date.Interval('0:00:01') sec2 = date.Interval('0:00:02') + sec3 = date.Interval('0:00:03') jp0 = dict(title = 'spam') # Non-existing property changed jp1 = dict(nonexisting = None) - journal.append ((id, now, '1', 'set', jp1)) + journal.append ((id, now+sec1, '1', 'set', jp1)) # Link from user-class to non-existing property jp2 = ('user', '1', 'xyzzy') - journal.append ((id, now+sec, '1', 'link', jp2)) + journal.append ((id, now+sec2, '1', 'link', jp2)) # Link from non-existing class jp3 = ('frobozz', '1', 'xyzzy') - journal.append ((id, now+sec2, '1', 'link', jp3)) + journal.append ((id, now+sec3, '1', 'link', jp3)) self.db.setjournal('issue', id, journal) self.db.commit() result=self.db.issue.history(id) @@ -1460,6 +1461,9 @@ print(result) # following test fails sometimes under sqlite # in travis. Looks like an ordering issue # in python 3.5. Print result to debug. + # is system runs fast enough, timestamp can + # be the same on two journal items. Ordering + # in that case is random. self.assertEqual(result [2][4], jp1) self.assertEqual(result [3][4], jp2) self.assertEqual(result [4][4], jp3)
