diff options
| author | Thomi Richards <thomi.richards@canonical.com> | 2012-04-18 13:45:00 +1200 |
|---|---|---|
| committer | Thomi Richards <thomi.richards@canonical.com> | 2012-04-18 13:45:00 +1200 |
| commit | 7ff5ea818418ef589cf7917dbaaeb2a90f89310a (patch) | |
| tree | 35f4c75ae722c46836e498bfa83ececb462629b1 /tests | |
| parent | 4bfd3bd3d402984129b0c1907fcefbcb01cee58d (diff) | |
Check match and wait_for attribute are callables.:
(bzr r2220.1.19)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/autopilot/autopilot/matchers/__init__.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/autopilot/autopilot/matchers/__init__.py b/tests/autopilot/autopilot/matchers/__init__.py index 1caec0786..f0ac66fbd 100644 --- a/tests/autopilot/autopilot/matchers/__init__.py +++ b/tests/autopilot/autopilot/matchers/__init__.py @@ -17,15 +17,15 @@ class Eventually(Matcher): def __init__(self, matcher): super(Eventually, self).__init__() match_fun = getattr(matcher, 'match', None) - if match_fun is None: + if match_fun is None or not callable(match_fun): raise TypeError("Eventually must be called with a testtools matcher argument.") self.matcher = matcher def match(self, value): wait_fun = getattr(value, 'wait_for', None) - if wait_fun is None: + if wait_fun is None or not callable(wait_fun): raise TypeError("Eventually can only be used against autopilot attributes that have a wait_for funtion.") - value.wait_for(self.matcher) + wait_fun(self.matcher) def __str__(self): return "Eventually " + str(self.matcher) |
