<p>Kevin Harwell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9283">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">matcher.py: Always check final conditions<br><br>The matcher functionality was checking the final conditions only if the test<br>was marked as passed. Since the initial default value for that the test_case<br>variable is 'None' this could cause the test to fail, but not error messages<br>were output.<br><br>This patch makes it so the final condtions in matcher are always checked when<br>the test ends. Also if all final conditions pass then the test object is set<br>to passing (passed=true). Lastly the error message output was updated to make<br>it a little more readable.<br><br>Change-Id: Ibdd3041e8fb023b9396d80ec766ade934e50bcaa<br>---<br>M lib/python/asterisk/matcher.py<br>1 file changed, 11 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/83/9283/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/lib/python/asterisk/matcher.py b/lib/python/asterisk/matcher.py<br>index 87c62be..958c9ad 100644<br>--- a/lib/python/asterisk/matcher.py<br>+++ b/lib/python/asterisk/matcher.py<br>@@ -128,9 +128,13 @@<br>     def error(self):<br>         """Error out the conditional."""<br> <br>-        return ("\nCondition: '{0}'\nExpected >= {1} and <= {2} but "<br>-                "received {3}".format(self.pattern, self.minimum,<br>-                                      self.maximum, self.count))<br>+        if self.minimum == self.maximum:<br>+            expected = "{0}".format(self.minimum)<br>+        else:<br>+            expected = ">= {0} and <= {1}".format(self.minimum, self.maximum)<br>+<br>+        return ("\nCondition: '{0}'\nExpected {1} but received {2}".format(<br>+            self.pattern, expected, self.count))<br> <br> <br> class Conditions(object):<br>@@ -274,11 +278,10 @@<br>             self.fail_and_stop(e)<br> <br>     def check_final(self):<br>-        if self.test_object.passed:<br>-            try:<br>-                self.conditions.check_final()<br>-            except ConditionError as e:<br>-                self.fail_and_stop(e)<br>+        try:<br>+            self.test_object.set_passed(self.conditions.check_final())<br>+        except ConditionError as e:<br>+            self.fail_and_stop(e)<br>         return self.test_object.passed<br> <br>     def __handle_stop(self, *args):<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9283">change 9283</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9283"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ibdd3041e8fb023b9396d80ec766ade934e50bcaa </div>
<div style="display:none"> Gerrit-Change-Number: 9283 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>