Bug #10124
closed
Review comments:
- AssertWithin might be clearer if AssertWithinInterval? Also, instead of “seconds” can you please call it “interval”?
- In AssertWithin -> attempt, can you add a "time expired" message to "raise" when "time.time() > self.deadline"?
- Am I understanding it correctly (sorry, python) that if AssertWithin -> attempt, if the “fn” fails for any other errors, they will be raised and the test will fail as needed?
Radhika Chippada wrote:
- AssertWithin might be clearer if AssertWithinInterval? Also, instead of “seconds” can you please call it “interval”?
Changed to AssertWithTimeout(timeout=x) -- timeout seems to be the customary Python word for this.
- In AssertWithin -> attempt, can you add a "time expired" message to "raise" when "time.time() > self.deadline"?
"raise" by itself raises the original assertion error with test's own message, which seems more useful. For example, changing the timeout from 10 to 0.00001 results in
runTest (tests.test_mount.FuseUpdateFromEventTest) ... FAIL
======================================================================
FAIL: runTest (tests.test_mount.FuseUpdateFromEventTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tom/src/arvados/services/fuse/tests/test_mount.py", line 744, in runTest
attempt(self.assertEqual, ["file1.txt"], llfuse.listdir(os.path.join(self.mounttmp)))
File "/home/tom/src/arvados/services/fuse/tests/test_mount.py", line 44, in attempt
fn(*args, **kwargs)
AssertionError: Lists differ: ['file1.txt'] != []
First list contains 1 additional elements.
First extra element 0:
file1.txt
- ['file1.txt']
+ []
- Am I understanding it correctly (sorry, python) that if AssertWithin -> attempt, if the “fn” fails for any other errors, they will be raised and the test will fail as needed?
Yes, that's right.
- Assigned To set to Tom Clegg
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
Applied in changeset arvados|commit:c2fdf5d225efe65edcab383b213eca27e2cca30e.
Also available in: Atom
PDF