Browse Source

[2225_statistics] do imp.reload(counter) in setUpClass()

Naoki Kambe 12 years ago
parent
commit
36df68ce89
1 changed files with 12 additions and 1 deletions
  1. 12 1
      src/lib/python/isc/statistics/tests/counter_test.py

+ 12 - 1
src/lib/python/isc/statistics/tests/counter_test.py

@@ -146,8 +146,10 @@ class TestBasicMethods(unittest.TestCase):
                                  timer_name), 0)
                                  timer_name), 0)
 
 
 class BaseTestCounter():
 class BaseTestCounter():
-    def setUp(self):
+    @classmethod
+    def setUpClass(cls):
         imp.reload(counter)
         imp.reload(counter)
+    def setUp(self):
         self._module_spec = isc.config.module_spec_from_file(
         self._module_spec = isc.config.module_spec_from_file(
             self.TEST_SPECFILE_LOCATION)
             self.TEST_SPECFILE_LOCATION)
         self.counter = counter.Counter.init(self.TEST_SPECFILE_LOCATION)
         self.counter = counter.Counter.init(self.TEST_SPECFILE_LOCATION)
@@ -324,6 +326,9 @@ class BaseTestCounter():
 
 
 class TestCounter1(unittest.TestCase, BaseTestCounter):
 class TestCounter1(unittest.TestCase, BaseTestCounter):
     TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec1.spec'
     TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec1.spec'
+    @classmethod
+    def setUpClass(cls):
+        BaseTestCounter.setUpClass()
     def setUp(self):
     def setUp(self):
         BaseTestCounter.setUp(self)
         BaseTestCounter.setUp(self)
     def tearDown(self):
     def tearDown(self):
@@ -331,6 +336,9 @@ class TestCounter1(unittest.TestCase, BaseTestCounter):
 
 
 class TestCounter2(unittest.TestCase, BaseTestCounter):
 class TestCounter2(unittest.TestCase, BaseTestCounter):
     TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec2.spec'
     TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec2.spec'
+    @classmethod
+    def setUpClass(cls):
+        BaseTestCounter.setUpClass()
     def setUp(self):
     def setUp(self):
         BaseTestCounter.setUp(self)
         BaseTestCounter.setUp(self)
     def tearDown(self):
     def tearDown(self):
@@ -338,6 +346,9 @@ class TestCounter2(unittest.TestCase, BaseTestCounter):
 
 
 class TestCounter3(unittest.TestCase, BaseTestCounter):
 class TestCounter3(unittest.TestCase, BaseTestCounter):
     TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec3.spec'
     TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec3.spec'
+    @classmethod
+    def setUpClass(cls):
+        BaseTestCounter.setUpClass()
     def setUp(self):
     def setUp(self):
         BaseTestCounter.setUp(self)
         BaseTestCounter.setUp(self)
     def tearDown(self):
     def tearDown(self):