Skip to content

Commit 0503366

Browse files
jenshnielsenWilliamHPNielsen
authored andcommitted
make wait time test more robust (#787)
1 parent 9524987 commit 0503366

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

qcodes/tests/test_helpers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,12 @@ def test_good_calls(self):
239239
finish_clock = time.perf_counter() + secs
240240
secs_out = wait_secs(finish_clock)
241241
self.assertGreater(secs_out, secs - 1e-4)
242-
self.assertLessEqual(secs_out, secs)
242+
# add a tiny offset as this test may fail if
243+
# otherwise if the two calls to perf_counter are close
244+
# enough to return the same result as a + b - a cannot
245+
# in general be assumed to be <= b in floating point
246+
# math (here a is perf_counter() and b is the wait time
247+
self.assertLessEqual(secs_out, secs+1e-14)
243248

244249
def test_warning(self):
245250
with LogCapture() as logs:

0 commit comments

Comments
 (0)