BIND 10 trac2225_statistics, updated. 2a337c756ad1064af1cbcaa8cd2c79be65f0b4d5 [2225_statistics] do imp.reload(counters) in setUp() method instead of in setUpClass() method
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Jan 15 08:40:51 UTC 2013
The branch, trac2225_statistics has been updated
via 2a337c756ad1064af1cbcaa8cd2c79be65f0b4d5 (commit)
via 28a20a3ee754d03ea90f13f76fa8e6d44c696b69 (commit)
via 2ad5c3c52b9106f68a6fb24a2ebfc85067877a04 (commit)
from be258adbecd48f1d46e47566f54843db1b579b9c (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 2a337c756ad1064af1cbcaa8cd2c79be65f0b4d5
Author: Naoki Kambe <naoki.kambe at gmail.com>
Date: Tue Jan 15 17:20:23 2013 +0900
[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.
commit 28a20a3ee754d03ea90f13f76fa8e6d44c696b69
Author: Naoki Kambe <naoki.kambe at gmail.com>
Date: Tue Jan 15 17:07:40 2013 +0900
[2225_statistics] Revert "[2225_statistics] use timedelta.total_seconds() instead of redundant computation"
This reverts commit 31b16f3568b95073fc15b68e435215572f25c5b8.
This is because timedelta.total_seconds() is not supported yet on Python3.1.
commit 2ad5c3c52b9106f68a6fb24a2ebfc85067877a04
Author: Naoki Kambe <kambe at jprs.co.jp>
Date: Tue Jan 15 17:27:10 2013 +0900
[2225_statistics] rename counter.py to counters.py
-----------------------------------------------------------------------
Summary of changes:
src/lib/python/isc/statistics/Makefile.am | 2 +-
src/lib/python/isc/statistics/counters.py | 3 ++-
.../python/isc/statistics/tests/counters_test.py | 21 ++++----------------
3 files changed, 7 insertions(+), 19 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/statistics/Makefile.am b/src/lib/python/isc/statistics/Makefile.am
index e269b1e..9be1312 100644
--- a/src/lib/python/isc/statistics/Makefile.am
+++ b/src/lib/python/isc/statistics/Makefile.am
@@ -1,6 +1,6 @@
SUBDIRS = . tests
-python_PYTHON = __init__.py counter.py
+python_PYTHON = __init__.py counters.py
pythondir = $(pyexecdir)/isc/statistics
CLEANDIRS = __pycache__
diff --git a/src/lib/python/isc/statistics/counters.py b/src/lib/python/isc/statistics/counters.py
index d824bda..8da0b1e 100644
--- a/src/lib/python/isc/statistics/counters.py
+++ b/src/lib/python/isc/statistics/counters.py
@@ -126,7 +126,8 @@ def _stop_timer(start_time, element, spec, identifier):
the element, which is in seconds between start_time and the
current time and is float-type."""
delta = datetime.now() - start_time
- sec = delta.total_seconds()
+ sec = round(delta.days * 86400 + delta.seconds + \
+ delta.microseconds * 1E-6, 6)
_set_counter(element, spec, identifier, sec)
def _concat(*args, sep='/'):
diff --git a/src/lib/python/isc/statistics/tests/counters_test.py b/src/lib/python/isc/statistics/tests/counters_test.py
index 4ac3919..ff15efc 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()
More information about the bind10-changes
mailing list