Browse Source

[master] Fix callable() check in unit test

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)
Jelte Jansen 12 years ago
parent
commit
3b408810eb
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/bin/msgq/tests/msgq_test.py

+ 2 - 1
src/bin/msgq/tests/msgq_test.py

@@ -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