Skip to content

Commit

Permalink
make wait time test more robust (#787)
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshnielsen authored and WilliamHPNielsen committed Oct 10, 2017
1 parent 9524987 commit 0503366
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion qcodes/tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,12 @@ def test_good_calls(self):
finish_clock = time.perf_counter() + secs
secs_out = wait_secs(finish_clock)
self.assertGreater(secs_out, secs - 1e-4)
self.assertLessEqual(secs_out, secs)
# add a tiny offset as this test may fail if
# otherwise if the two calls to perf_counter are close
# enough to return the same result as a + b - a cannot
# in general be assumed to be <= b in floating point
# math (here a is perf_counter() and b is the wait time
self.assertLessEqual(secs_out, secs+1e-14)

def test_warning(self):
with LogCapture() as logs:
Expand Down

0 comments on commit 0503366

Please sign in to comment.