BIND 10 trac2781, updated. 3669c95989ed36429f32a593d74f58dd917663b2 [2781] define items() in DummDict class instead of using lambda, update note

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Aug 27 08:12:58 UTC 2013


The branch, trac2781 has been updated
       via  3669c95989ed36429f32a593d74f58dd917663b2 (commit)
       via  5207d193067cb884e6aa4ad63d1a96d52ef04f96 (commit)
       via  c3473496d36e6509c797fd6f55e9b9acd2ba8638 (commit)
      from  ad4c8681d9700216ccdcd347823c5131f2796d60 (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 3669c95989ed36429f32a593d74f58dd917663b2
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Fri Aug 23 18:15:37 2013 +0900

    [2781] define items() in DummDict class instead of using lambda, update note

commit 5207d193067cb884e6aa4ad63d1a96d52ef04f96
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Fri Aug 23 17:59:27 2013 +0900

    [2781] correct description of test_get_multi_module_list_initsessiontimeout()
    
    and revise the test code to match this

commit c3473496d36e6509c797fd6f55e9b9acd2ba8638
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Fri Aug 23 17:50:49 2013 +0900

    [2781] use for-loop instead of while-loop for avoiding from rewriting the iterator

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

Summary of changes:
 src/bin/stats/stats.py.in         |    5 +----
 src/bin/stats/tests/stats_test.py |   16 ++++++++--------
 2 files changed, 9 insertions(+), 12 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/stats/stats.py.in b/src/bin/stats/stats.py.in
index 35a48b7..707eeb8 100755
--- a/src/bin/stats/stats.py.in
+++ b/src/bin/stats/stats.py.in
@@ -343,11 +343,8 @@ class Stats:
         module, skips it and goes to collect from the next module."""
         # start receiving statistics data
         _statistics_data = []
-        _sequences = sequences[:]
-        while len(_sequences) > 0:
-            (module_name, seq) = (None, None)
+        for (module_name, seq) in sequences:
             try:
-                (module_name, seq) = _sequences.pop(0)
                 answer, env = self.cc_session.group_recvmsg(False, seq)
                 if answer:
                     rcode, args = isc.config.ccsession.parse_answer(answer)
diff --git a/src/bin/stats/tests/stats_test.py b/src/bin/stats/tests/stats_test.py
index 9a7ab74..14e49f9 100644
--- a/src/bin/stats/tests/stats_test.py
+++ b/src/bin/stats/tests/stats_test.py
@@ -1384,24 +1384,24 @@ class TestStats(unittest.TestCase):
         self.assertListEqual([], stat._get_multi_module_list())
 
     def test_get_multi_module_list_initsessiontimeout(self):
-        """Test _get_multi_module_list() returns an empty list if rcp_call()
-        raise a InitSeeionTimeout exception"""
+        """Test _get_multi_module_list() raises an InitSeeionTimeout exception
+        if a CC session times out in rcp_call()"""
         # InitSeeionTimeout case
         stat = MyStats()
-        ex = stats.InitSessionTimeout
+        ex = isc.cc.session.SessionTimeout
         def __raise(*x): raise ex(*x)
         stat.mccs.rpc_call = lambda x,y: __raise()
-        self.assertRaises(ex, stat._get_multi_module_list)
+        self.assertRaises(stats.InitSessionTimeout, stat._get_multi_module_list)
 
     def test_query_statistics(self):
         """Test _query_statistics returns a list of pairs of module and
         sequences from group_sendmsg()"""
         stat = MyStats()
-        # imitate stat.get_statistics_data().items
+        # imitate stat.get_statistics_data().items. The order of the array
+        # returned by items() should be preserved.
         class DummyDict:
-            items = lambda x: [
-                ('Init', 'dummy'), ('Stats', 'dummy'), ('Auth', 'dummy'),
-                ]
+            def items(self):
+                return [('Init', 'dummy'), ('Stats', 'dummy'), ('Auth', 'dummy')]
         stat.get_statistics_data = lambda: DummyDict()
         mod = ('Init', 'Auth', 'Auth')
         seq = [('Init', stat._seq + 1),



More information about the bind10-changes mailing list