[Pkg-mozext-commits] [requestpolicy] 89/257: [tst][imp] RPTestcase tearDown: assert "no rules"

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:20:00 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository requestpolicy.

commit dea4a37fde7d429102d8b6c8a38e4714f228e6bf
Author: Martin Kimmerle <dev at 256k.de>
Date:   Fri Oct 16 13:27:26 2015 +0200

    [tst][imp] RPTestcase tearDown: assert "no rules"
---
 tests/marionette/rp_ui_harness/testcases.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/marionette/rp_ui_harness/testcases.py b/tests/marionette/rp_ui_harness/testcases.py
index edd9b59..db07567 100644
--- a/tests/marionette/rp_ui_harness/testcases.py
+++ b/tests/marionette/rp_ui_harness/testcases.py
@@ -37,6 +37,15 @@ class RequestPolicyTestCase(RequestPolicyPuppeteer, FirefoxTestCase):
         finally:
             self._reset_error_counts()
 
+    def _check_rules_and_remove_all(self):
+        try:
+            n_rules = self.rules.count_rules()
+            self.assertEqual(n_rules, 0,
+                             "A test must not leak rules. Rule count is {}, "
+                             "but should be zero.".format(n_rules))
+        finally:
+            self.rules.remove_all()
+
 
     def setUp(self, *args, **kwargs):
         FirefoxTestCase.setUp(self, *args, **kwargs)
@@ -49,8 +58,7 @@ class RequestPolicyTestCase(RequestPolicyPuppeteer, FirefoxTestCase):
 
     def tearDown(self, *args, **kwargs):
         try:
-            self.rules.remove_all()
-
+            self._check_rules_and_remove_all()
             self._check_and_reset_error_counts()
         finally:
             FirefoxTestCase.tearDown(self, *args, **kwargs)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git



More information about the Pkg-mozext-commits mailing list