[svn] commit: r1477 - in /trunk: configure.ac src/lib/python/isc/cc/session.py src/lib/python/isc/cc/tests/cc_test.in src/lib/python/isc/cc/tests/session_test.py

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Mar 17 16:00:15 UTC 2010


Author: jelte
Date: Wed Mar 17 16:00:15 2010
New Revision: 1477

Log:
added 'offline' unit tests for lib/python/isc/cc/session.py
these don't need the msgq running
we might want to look into the previous test_session.py to see
how much can be moved to this one

Added:
    trunk/src/lib/python/isc/cc/tests/cc_test.in
      - copied, changed from r1441, trunk/src/lib/python/isc/config/tests/config_test.in
    trunk/src/lib/python/isc/cc/tests/session_test.py
Modified:
    trunk/configure.ac
    trunk/src/lib/python/isc/cc/session.py

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Wed Mar 17 16:00:15 2010
@@ -271,6 +271,7 @@
            src/bin/auth/spec_config.h
            src/lib/config/tests/data_def_unittests_config.h
            src/lib/python/isc/config/tests/config_test
+           src/lib/python/isc/cc/tests/cc_test
            src/lib/dns/gen-rdatacode.py
            src/lib/dns/tests/testdata/gen-wiredata.py
           ], [

Modified: trunk/src/lib/python/isc/cc/session.py
==============================================================================
--- trunk/src/lib/python/isc/cc/session.py (original)
+++ trunk/src/lib/python/isc/cc/session.py Wed Mar 17 16:00:15 2010
@@ -77,17 +77,20 @@
             self._socket.send(msg)
 
     def recvmsg(self, nonblock = True, seq = None):
+        #print("[XX] queue len: " + str(len(self._queue)))
         if len(self._queue) > 0:
             if seq == None:
-                msg, env = self._queue.pop(0)
+                #print("[XX] return first")
+                return self._queue.pop(0)
             else:
                 i = 0;
-                for msg, env in self._queue:
+                #print("[XX] check rest")
+                for env, msg in self._queue:
                     if "reply" in env and seq == env["reply"]:
-                        self._queue.remove(i)
-                        return env, msg
+                        return self._queue.pop(i)
                     else:
                         i = i + 1
+                #print("[XX] not found")
         if self._closed:
             raise SessionError("Session has been closed.")
         data = self._receive_full_buffer(nonblock)




More information about the bind10-changes mailing list