BIND 10 trac2883, updated. 8ce213f2e0eb1cfd313897288e08be41047cdbd7 [2883] None not acceptable for spec_file_name of the Counters class
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Aug 27 08:13:04 UTC 2013
The branch, trac2883 has been updated
via 8ce213f2e0eb1cfd313897288e08be41047cdbd7 (commit)
via 0207a121a00d0e419a6d067d75696a08b1d1e679 (commit)
from 516bb5392ff827f17b7c91d42b6c4f3151a2bf44 (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 8ce213f2e0eb1cfd313897288e08be41047cdbd7
Author: Naoki Kambe <kambe at jprs.co.jp>
Date: Tue Aug 27 16:15:44 2013 +0900
[2883] None not acceptable for spec_file_name of the Counters class
Remove condition that spec_file_name is omitted (None is specified). Revise
documentation of Counters and add a unit test to assert an exception raised when
specifying an invalid argument.
commit 0207a121a00d0e419a6d067d75696a08b1d1e679
Author: Naoki Kambe <kambe at jprs.co.jp>
Date: Tue Aug 27 15:49:49 2013 +0900
[2883] change module_description of a spec file for testing
-----------------------------------------------------------------------
Summary of changes:
.../isc/notify/tests/testdata/test_spec1.spec | 2 +-
src/lib/python/isc/statistics/counters.py | 9 ++-------
.../python/isc/statistics/tests/counters_test.py | 20 ++++++++------------
3 files changed, 11 insertions(+), 20 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/notify/tests/testdata/test_spec1.spec b/src/lib/python/isc/notify/tests/testdata/test_spec1.spec
index 922b4d7..7ac8013 100644
--- a/src/lib/python/isc/notify/tests/testdata/test_spec1.spec
+++ b/src/lib/python/isc/notify/tests/testdata/test_spec1.spec
@@ -1,7 +1,7 @@
{
"module_spec": {
"module_name": "NotifyOutLike",
- "module_description": "XFR in daemon",
+ "module_description": "Test notifier",
"config_data": [],
"commands": [],
"statistics": [
diff --git a/src/lib/python/isc/statistics/counters.py b/src/lib/python/isc/statistics/counters.py
index d1922ee..dcdd247 100644
--- a/src/lib/python/isc/statistics/counters.py
+++ b/src/lib/python/isc/statistics/counters.py
@@ -168,19 +168,14 @@ class Counters():
def __init__(self, spec_file_name):
"""A constructor for the Counters class. A path to the spec file
can be specified in spec_file_name, which is required. Statistics data
- based on statistics spec can be accumulated if spec_file_name is
- specified. If omitted, a default statistics spec is used. The
- default statistics spec is defined in a hidden class named
- _Statistics().
+ based on statistics spec can be accumulated. If an invalid argument
+ including None is specified, ModuleSpecError might be raised.
"""
self._zones_item_list = []
self._start_time = {}
self._disabled = False
self._rlock = threading.RLock()
self._statistics_data = {}
- self._statistics_spec = []
- if not spec_file_name: return
- # change the default statistics spec
self._statistics_spec = \
isc.config.module_spec_from_file(spec_file_name).\
get_statistics_spec()
diff --git a/src/lib/python/isc/statistics/tests/counters_test.py b/src/lib/python/isc/statistics/tests/counters_test.py
index a0ea8b1..9d61ba3 100644
--- a/src/lib/python/isc/statistics/tests/counters_test.py
+++ b/src/lib/python/isc/statistics/tests/counters_test.py
@@ -154,6 +154,14 @@ class TestBasicMethods(unittest.TestCase):
b = a + ({},)
self.assertRaises(TypeError, counters._concat, *b)
+ def test_none_of_arg_of_counters(self):
+ """Test Counters raises ModuleSpecError when specifying not valid
+ argument"""
+ self.assertRaises(isc.config.module_spec.ModuleSpecError,
+ counters.Counters, None)
+ self.assertRaises(isc.config.module_spec.ModuleSpecError,
+ counters.Counters, '/foo/bar')
+
class BaseTestCounters():
def setUp(self):
@@ -195,18 +203,6 @@ class BaseTestCounters():
self.assertRaises(isc.cc.data.DataNotFoundError,
self.counters.get, '__undefined__')
-class TestCounters0(unittest.TestCase, BaseTestCounters):
- TEST_SPECFILE_LOCATION = None
- def setUp(self):
- BaseTestCounters.setUp(self)
-
- def test_counters(self):
- self.assertRaises(isc.cc.data.DataNotFoundError, self.counters.inc,
- "foo")
- self.assertRaises(isc.cc.data.DataNotFoundError, self.counters.get,
- "foo")
- self.check_get_statistics()
-
class TestCounters1(unittest.TestCase, BaseTestCounters):
TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec1.spec'
def setUp(self):
More information about the bind10-changes
mailing list