]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Fix callable() check in unit test
authorJelte Jansen <jelte@isc.org>
Thu, 29 Nov 2012 17:13:22 +0000 (18:13 +0100)
committerJelte Jansen <jelte@isc.org>
Thu, 29 Nov 2012 17:13:22 +0000 (18:13 +0100)
callable() has been removed in Python 3, but was reintroduced in Python 3.2. This fix (check for isinstance(obj, collections.Callable) should make the test work with 3.1 and older versions of 3.

(acked on jabber)

src/bin/msgq/tests/msgq_test.py

index 4ed0441933d32837865e5c662c2071c5ea7f405f..40601909137d167210ba30a26f59af25c2ea9019 100644 (file)
@@ -9,6 +9,7 @@ import time
 import errno
 import threading
 import isc.cc
+import collections
 
 #
 # Currently only the subscription part and some sending is implemented...
@@ -153,7 +154,7 @@ class BadSocket:
     # (except explicitely overridden ones)
     def __getattr__(self, name, *args):
         attr = getattr(self.socket, name)
-        if callable(attr):
+        if isinstance(attr, collections.Callable):
             def callable_attr(*args):
                 return attr.__call__(*args)
             return callable_attr