From: Naoki Kambe Date: Tue, 15 Jan 2013 08:20:23 +0000 (+0900) Subject: [2225_statistics] do imp.reload(counters) in setUp() method instead of in setUpClass... X-Git-Tag: bind10-1.1.0beta1-release~72^2~40^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2a337c756ad1064af1cbcaa8cd2c79be65f0b4d5;p=thirdparty%2Fkea.git [2225_statistics] do imp.reload(counters) in setUp() method instead of in setUpClass() method Because it was found that reloading in setUp() method was not enough in another environment. --- diff --git a/src/lib/python/isc/statistics/tests/counters_test.py b/src/lib/python/isc/statistics/tests/counters_test.py index 4ac391952b..ff15efc2ec 100644 --- a/src/lib/python/isc/statistics/tests/counters_test.py +++ b/src/lib/python/isc/statistics/tests/counters_test.py @@ -50,6 +50,7 @@ class TestBasicMethods(unittest.TestCase): TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec1.spec' def setUp(self): + imp.reload(counters) self.counters = counters.Counters(self.TEST_SPECFILE_LOCATION) def tearDown(self): @@ -161,6 +162,7 @@ class TestBasicMethods(unittest.TestCase): class BaseTestCounters(): def setUp(self): + imp.reload(counters) self._statistics_data = {} self.counters = counters.Counters(self.TEST_SPECFILE_LOCATION) self._entire_server = self.counters._entire_server @@ -287,9 +289,6 @@ class BaseTestCounters(): class TestCounters0(unittest.TestCase, BaseTestCounters): TEST_SPECFILE_LOCATION = None - @classmethod - def setUpClass(cls): - imp.reload(counters) def setUp(self): BaseTestCounters.setUp(self) def tearDown(self): @@ -297,9 +296,6 @@ class TestCounters0(unittest.TestCase, BaseTestCounters): class TestCounters1(unittest.TestCase, BaseTestCounters): TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec1.spec' - @classmethod - def setUpClass(cls): - imp.reload(counters) def setUp(self): BaseTestCounters.setUp(self) def tearDown(self): @@ -307,9 +303,6 @@ class TestCounters1(unittest.TestCase, BaseTestCounters): class TestCounters2(unittest.TestCase, BaseTestCounters): TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec2.spec' - @classmethod - def setUpClass(cls): - imp.reload(counters) def setUp(self): BaseTestCounters.setUp(self) def tearDown(self): @@ -381,11 +374,8 @@ class DummyXfroutServer(BaseDummyModule): class TestDummyNotifyOut(unittest.TestCase): """Tests counters are incremented in which the spec file is not loaded""" - @classmethod - def setUpClass(cls): - imp.reload(counters) - def setUp(self): + imp.reload(counters) self.notifier = DummyNotifyOut() self.notifier.inc_counters() @@ -401,11 +391,8 @@ class TestDummyNotifyOut(unittest.TestCase): class TestDummyXfroutServer(unittest.TestCase): """Tests counters are incremented or decremented in which the same spec file is multiply loaded in each child class""" - @classmethod - def setUpClass(cls): - imp.reload(counters) - def setUp(self): + imp.reload(counters) self.xfrout_server = DummyXfroutServer() self.xfrout_server.inc_counters()