PROTON-490: enable six.py support for operator method calls

Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/93ccc736
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/93ccc736
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/93ccc736

Branch: refs/heads/master
Commit: 93ccc7364bfe28d3076a441409be8cbc5c88128b
Parents: adfe2a2
Author: Ken Giusti <[email protected]>
Authored: Wed Apr 22 15:09:45 2015 -0400
Committer: Ken Giusti <[email protected]>
Committed: Wed Apr 22 15:09:45 2015 -0400

----------------------------------------------------------------------
 tests/python/six.py | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/93ccc736/tests/python/six.py
----------------------------------------------------------------------
diff --git a/tests/python/six.py b/tests/python/six.py
index ffa3fe1..4b572bb 100644
--- a/tests/python/six.py
+++ b/tests/python/six.py
@@ -32,6 +32,17 @@ __author__ = "Benjamin Peterson <[email protected]>"
 __version__ = "1.9.0"
 
 
+# begin QPID
+# added to support running the unit tests under JYTHON
+if not hasattr(operator, 'methodcaller'):
+    def _methodcaller(cls, name, *args, **kwargs):
+        def caller(obj):
+            return getattr(obj, name)(*args, **kwargs)
+        return caller
+    operator.methodcaller = classmethod(_methodcaller)
+# QPID end
+
+
 # Useful for very coarse version differentiation.
 PY2 = sys.version_info[0] == 2
 PY3 = sys.version_info[0] == 3


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to