From 8649f6fd1a44f0c29d648003dd1dc647b211e939 Mon Sep 17 00:00:00 2001 From: Dan Cech Date: Wed, 6 Dec 2017 09:52:03 -0500 Subject: [PATCH] work around timing issue in whisper reader interval tests --- webapp/tests/test_readers_whisper.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/webapp/tests/test_readers_whisper.py b/webapp/tests/test_readers_whisper.py index 15617c2ee..aa91617c7 100644 --- a/webapp/tests/test_readers_whisper.py +++ b/webapp/tests/test_readers_whisper.py @@ -79,14 +79,14 @@ def test_GzippedWhisperReader_get_intervals(self): ts = int(time.time()) intervals = reader.get_intervals() for interval in intervals: - self.assertEqual(int(interval.start), ts-60) - self.assertEqual(int(interval.end), ts) + self.assertEqual(int(interval.start), ts - 60) + self.assertIn(int(interval.end), [ts, ts - 1]) # read it again to validate cache works intervals = reader.get_intervals() for interval in intervals: - self.assertEqual(int(interval.start),ts-60) - self.assertEqual(int(interval.end), ts) + self.assertEqual(int(interval.start),ts - 60) + self.assertIn(int(interval.end), [ts, ts - 1]) # Confirm fetch works. def test_GzippedWhisperReader_fetch(self): @@ -120,14 +120,14 @@ def test_WhisperReader_get_intervals(self): ts = int(time.time()) intervals = reader.get_intervals() for interval in intervals: - self.assertEqual(int(interval.start),ts-60) - self.assertEqual(int(interval.end), ts) + self.assertEqual(int(interval.start),ts - 60) + self.assertIn(int(interval.end), [ts, ts - 1]) # read it again to validate cache works intervals = reader.get_intervals() for interval in intervals: - self.assertEqual(int(interval.start),ts-60) - self.assertEqual(int(interval.end), ts) + self.assertEqual(int(interval.start),ts - 60) + self.assertIn(int(interval.end), [ts, ts - 1]) # Confirm get_raw_step works def test_WhisperReader_get_raw_step(self):