Eventually matcher can't handle the Raises matcher
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| Autopilot |
High
|
Unassigned | ||
| autopilot (Ubuntu) |
Undecided
|
Unassigned |
Bug Description
When we use Eventually in combination with the Raises matcher, the exception thrown is not caught.
>>> from autopilot.matchers import Eventually
>>> from testtools.matchers import raises
>>> matcher = Eventually(
>>> def bad_fn():
... raise RuntimeError(
...
>>> bad_fn()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in bad_fn
RuntimeError: Hello
>>> matcher.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/
wait_
File "/usr/lib/
new_value = refresh_fn()
File "<stdin>", line 2, in bad_fn
RuntimeError: Hello
Related branches
- Leo Arias (community): Approve on 2014-02-05
- Christopher Lee (community): Approve on 2014-02-05
- PS Jenkins bot: Approve (continuous-integration) on 2014-02-05
-
Diff: 22 lines (+4/-1)1 file modifiedautopilot/matchers/__init__.py (+4/-1)
Leo Arias (elopio) wrote : | #2 |
I'm out of ideas. For now, I won't feel bad if we just document that Eventually is not compatible with raises.
Changed in autopilot: | |
assignee: | Leo Arias (elopio) → nobody |
status: | In Progress → Triaged |
Changed in autopilot: | |
assignee: | nobody → Thomi Richards (thomir) |
status: | Triaged → In Progress |
Launchpad Janitor (janitor) wrote : | #3 |
This bug was fixed in the package autopilot - 1.4+14.
---------------
autopilot (1.4+14.
[ CI bot ]
* Resync trunk
[ Christopher Lee ]
* Deprecating the use of AutopilotTestCa
* Fix a regression in the "autopilot launch" command which meant that
application arguments were taken as the application to launch. (LP:
#1275913)
[ Thomi Richards ]
* Remove ibus.py from autopilot, as it should live in lp:unity. (LP:
#1210661)
* Add unit tests to the autopilot.run module.
* Refactor parts of the 'autopilot.run' module, adding unit tests and
simplifying the code along the way.
* Fix docs WRT Eventually matcher's interaction with Raises() matcher.
(LP: #1244490)
* Get display resolution using fbset, falling back to hard coded
values based on image codename on phablet devices.
* Fix functional tests that started failing when window-mocker
changed. (LP: #1278187)
* Add unit tests for missing coverage on code that picks device
backends at runtime.
* Fix a bug where autopilot didn't do the right thing with non-unicode
valid bytestrings. (LP: #1278272)
-- Ubuntu daily release <email address hidden> Wed, 12 Feb 2014 01:14:02 +0000
Changed in autopilot (Ubuntu): | |
status: | New → Fix Released |
Changed in autopilot: | |
status: | In Progress → Fix Released |
This is a bug in autopilot. The root problem is that we allow people to pass in a callable method to assertThat, like so:
self.assertThat (lambda: self.get_thing(1, 2, 3), Eventually( Equals( 'something' )))
The Eventually matcher breaks the behavior defined in testtools - it calls the matchee when it should instead pass it to the underlying matcher.
I think we need to figure out how to fix this. Off the top of my head, there's no easy solution. Need to think about this some more. Suggestions welcome;