BIND 10 trac2225_statistics, updated. 0a10b2ed25935e83cd0402ae4df81e6d321d75e8 [2225_statistics] change the order of the parent classes and add setUp() and tearDown() into the child classes

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Nov 26 13:10:51 UTC 2012


The branch, trac2225_statistics has been updated
       via  0a10b2ed25935e83cd0402ae4df81e6d321d75e8 (commit)
       via  78a4e4cd8735ad72dcaafe9701482c34d72fef3e (commit)
       via  d834a1a1b95f67b2ea2467b75e00fdfe9ac0c763 (commit)
       via  abd4fe9ffe48402cafdac9c1145f25c43da62332 (commit)
       via  2c8b5b294bf5498b9525dcc1dcba7ca1869f01b6 (commit)
      from  c6aa9a4c2e17c51b28b91cef5b773b935caf317e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0a10b2ed25935e83cd0402ae4df81e6d321d75e8
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Mon Nov 26 22:08:12 2012 +0900

    [2225_statistics] change the order of the parent classes and add setUp() and tearDown() into the child classes

commit 78a4e4cd8735ad72dcaafe9701482c34d72fef3e
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Mon Nov 26 22:07:06 2012 +0900

    [2225_statistics] reload module in setUp()

commit d834a1a1b95f67b2ea2467b75e00fdfe9ac0c763
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Mon Nov 26 22:06:30 2012 +0900

    [2225_statistics] should not do this test unless there is no timer parameter(time_to_xxx) in statistics spec

commit abd4fe9ffe48402cafdac9c1145f25c43da62332
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Mon Nov 26 22:05:28 2012 +0900

    [2225_statistics] add tearDown()
    
    clear statistics data when every test is finished

commit 2c8b5b294bf5498b9525dcc1dcba7ca1869f01b6
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Mon Nov 26 22:04:42 2012 +0900

    [2225_statistics] revise a comment

-----------------------------------------------------------------------

Summary of changes:
 .../python/isc/statistics/tests/counter_test.py    |   32 +++++++++++++++++---
 1 file changed, 27 insertions(+), 5 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/statistics/tests/counter_test.py b/src/lib/python/isc/statistics/tests/counter_test.py
index 0837190..947bd41 100644
--- a/src/lib/python/isc/statistics/tests/counter_test.py
+++ b/src/lib/python/isc/statistics/tests/counter_test.py
@@ -146,8 +146,8 @@ class TestBasicMethods(unittest.TestCase):
                                  timer_name), 0)
 
 class BaseTestCounter():
-    imp.reload(counter)
     def setUp(self):
+        imp.reload(counter)
         self._module_spec = isc.config.module_spec_from_file(
             self.TEST_SPECFILE_LOCATION)
         self.counter = counter.Counter.init(self.TEST_SPECFILE_LOCATION)
@@ -160,6 +160,9 @@ class BaseTestCounter():
         self._zones_item_list   = self.counter._zones_item_list
         self._started = threading.Event()
 
+    def tearDown(self):
+        self.counter.clear_counters()
+
     def test_perzone_counters(self):
         # for per-zone counters
         for counter_name in self._zones_item_list:
@@ -261,6 +264,13 @@ class BaseTestCounter():
         self.check_dump_statistics()
 
     def test_perzone_timers(self):
+        # should not do this test unless there is no timer
+        # parameter(time_to_xxx) in statistics spec
+        has_timer = False
+        for counter_name in self._zones_item_list:
+            if counter_name.find('time_to_') == 0:
+                has_timer = True
+        if not has_timer: return
         # for timer counters
         for counter_name in self._zones_item_list:
             if counter_name.find('time_to_') == -1:
@@ -292,7 +302,7 @@ class BaseTestCounter():
         self.check_dump_statistics()
 
     def test_ipsocket_counters(self):
-        # for unixsocket counters
+        # for ipsocket counters
         for counter_name in self._ipsocket_names:
             incrementer = self.counter._to_global\
                 ['inc_%ssocket_%s' % counter_name]
@@ -312,14 +322,26 @@ class BaseTestCounter():
                 'socket/%s/tcp/%s' % counter_name, 2)
         self.check_dump_statistics()
 
-class TestCounter1(BaseTestCounter, unittest.TestCase):
+class TestCounter1(unittest.TestCase, BaseTestCounter):
     TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec1.spec'
+    def setUp(self):
+        BaseTestCounter.setUp(self)
+    def tearDown(self):
+        BaseTestCounter.tearDown(self)
 
-class TestCounter2(BaseTestCounter, unittest.TestCase):
+class TestCounter2(unittest.TestCase, BaseTestCounter):
     TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec2.spec'
+    def setUp(self):
+        BaseTestCounter.setUp(self)
+    def tearDown(self):
+        BaseTestCounter.tearDown(self)
 
-class TestCounter3(BaseTestCounter, unittest.TestCase):
+class TestCounter3(unittest.TestCase, BaseTestCounter):
     TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec3.spec'
+    def setUp(self):
+        BaseTestCounter.setUp(self)
+    def tearDown(self):
+        BaseTestCounter.tearDown(self)
 
 if __name__== "__main__":
     unittest.main()



More information about the bind10-changes mailing list