D-Bus testing: autoSyncInterval measures start<->start times

Both old and new implementation only look at the start times
of syncs to determine whether the autoSyncInterval is over.
D-Bus test should do the same. It still passed because of
the inaccurate time comparison. Now the comparison is more
likely to succeed.
This commit is contained in:
Patrick Ohly 2012-03-27 13:38:11 +02:00
parent 19d7dbbab8
commit e33b78ea8a
1 changed files with 3 additions and 3 deletions

View File

@ -2365,8 +2365,8 @@ class TestSessionAPIsDummy(unittest.TestCase, DBusUtil):
# wait for start and end of auto-sync session
loop.run()
start1 = time.time()
loop.run()
end = time.time()
self.assertEqual(DBusUtil.quit_events, ["session " + self.auto_sync_session_path + " ready",
"session " + self.auto_sync_session_path + " done"])
DBusUtil.quit_events = []
@ -2388,12 +2388,12 @@ class TestSessionAPIsDummy(unittest.TestCase, DBusUtil):
# check that interval between auto-sync sessions is right
loop.run()
start = time.time()
start2 = time.time()
loop.run()
self.assertEqual(DBusUtil.quit_events, ["session " + self.auto_sync_session_path + " ready",
"session " + self.auto_sync_session_path + " done"])
self.assertNotEqual(first_auto, self.auto_sync_session_path)
delta = start - end
delta = start2 - start1
# avoid timing checks when running under valgrind
if not usingValgrind():
self.assertTrue(delta < 13)