comparison test/db_test_base.py @ 4876:74b24b14071a

Fix issue2550835 Race condition for testing geek date intervals
author Ralf Schlatterbeck <rsc@runtux.com>
date Fri, 28 Mar 2014 15:14:29 +0100
parents 6998ad77841e
children f6e76a03b502
comparison
equal deleted inserted replaced
4875:cdec6ed210d0 4876:74b24b14071a
1365 ae(filt(None, {'foo': 'from 5:50'}), ['2']) 1365 ae(filt(None, {'foo': 'from 5:50'}), ['2'])
1366 ae(filt(None, {'foo': 'to 0:05'}), []) 1366 ae(filt(None, {'foo': 'to 0:05'}), [])
1367 1367
1368 def testFilteringRangeGeekInterval(self): 1368 def testFilteringRangeGeekInterval(self):
1369 ae, filter, filter_iter = self.filteringSetup() 1369 ae, filter, filter_iter = self.filteringSetup()
1370 # Note: When querying, create date one minute later than the
1371 # timespan later queried to avoid race conditions where the
1372 # creation of the deadline is more than a second ago when
1373 # queried -- in that case we wouldn't get the expected result.
1374 # By extending the interval by a minute we would need a very
1375 # slow machine for this test to fail :-)
1370 for issue in ( 1376 for issue in (
1371 { 'deadline': date.Date('. -2d')}, 1377 { 'deadline': date.Date('. -2d') + date.Interval ('00:01')},
1372 { 'deadline': date.Date('. -1d')}, 1378 { 'deadline': date.Date('. -1d') + date.Interval ('00:01')},
1373 { 'deadline': date.Date('. -8d')}, 1379 { 'deadline': date.Date('. -8d') + date.Interval ('00:01')},
1374 ): 1380 ):
1375 self.db.issue.create(**issue) 1381 self.db.issue.create(**issue)
1376 for filt in filter, filter_iter: 1382 for filt in filter, filter_iter:
1377 ae(filt(None, {'deadline': '-2d;'}), ['5', '6']) 1383 ae(filt(None, {'deadline': '-2d;'}), ['5', '6'])
1378 ae(filt(None, {'deadline': '-1d;'}), ['6']) 1384 ae(filt(None, {'deadline': '-1d;'}), ['6'])
1379 ae(filt(None, {'deadline': '-1w;'}), ['5', '6']) 1385 ae(filt(None, {'deadline': '-1w;'}), ['5', '6'])
1386 ae(filt(None, {'deadline': '. -2d;'}), ['5', '6'])
1387 ae(filt(None, {'deadline': '. -1d;'}), ['6'])
1388 ae(filt(None, {'deadline': '. -1w;'}), ['5', '6'])
1380 1389
1381 def testFilteringIntervalSort(self): 1390 def testFilteringIntervalSort(self):
1382 # 1: '1:10' 1391 # 1: '1:10'
1383 # 2: '1d' 1392 # 2: '1d'
1384 # 3: None 1393 # 3: None

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