You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2018/10/16 15:24:06 UTC

[2/2] qpid-proton git commit: NO-JIRA: [c, cpp] fix monkey-patch of python 2.7 unittest features for python 2.6

NO-JIRA: [c,cpp] fix monkey-patch of python 2.7 unittest features for python 2.6

Don't apply patch on versions that have the feature.


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

Branch: refs/heads/master
Commit: 8292110aa234df2a2826905edaebcbc79961d363
Parents: 7ba1bfa
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Oct 16 10:09:36 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Oct 16 11:03:10 2018 -0400

----------------------------------------------------------------------
 tests/py/test_unittest.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8292110a/tests/py/test_unittest.py
----------------------------------------------------------------------
diff --git a/tests/py/test_unittest.py b/tests/py/test_unittest.py
index afc863b..ebb8efc 100644
--- a/tests/py/test_unittest.py
+++ b/tests/py/test_unittest.py
@@ -19,10 +19,17 @@
 
 import unittest
 
-def assertMultiLineEqual(self, a, b, msg=None): self.assertEqual(a,b,msg)
-unittest.TestCase.assertMultiLineEqual = assertMultiLineEqual
+# Monkey-patch a few unittest 2.7 features for Python 2.6.
+#
+# These are note the pretty versions provided by 2.7 but they do the
+# same job as far as correctness is concerned.
+
+if not hasattr(unittest.TestCase, "assertMultiLineEqual"):
+    def assertMultiLineEqual(self, a, b, msg=None): self.assertEqual(a,b,msg)
+    unittest.TestCase.assertMultiLineEqual = assertMultiLineEqual
 
-def assertIn(self, a, b, msg=None): self.assertTrue(a in b,msg)
-unittest.TestCase.assertIn = assertIn
+if not hasattr(unittest.TestCase, "assertIn"):
+    def assertIn(self, a, b, msg=None): self.assertTrue(a in b,msg)
+    unittest.TestCase.assertIn = assertIn
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org