jenkins-bot has submitted this change and it was merged.

Change subject: [IMPROV] TestBaseCase: Only add backward compatible aliases if 
needed
......................................................................


[IMPROV] TestBaseCase: Only add backward compatible aliases if needed

Instead of assuming that Python 2 won't support currently Python 3
specific methods this just adds a wrapper for the old name if the new
name isn't implemented.

Change-Id: I1022d27fcecdc516b3ebf42dc3380458163b2aa4
---
M tests/aspects.py
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  John Vandenberg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/aspects.py b/tests/aspects.py
index d6da7b8..40edb6d 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -49,7 +49,7 @@
 
     """Base class for all tests."""
 
-    if sys.version_info[0] == 2:
+    if not hasattr(unittest.TestCase, 'assertRaisesRegex'):
         def assertRaisesRegex(self, *args, **kwargs):
             """
             Wrapper of unittest.assertRaisesRegexp for Python 2 unittest.
@@ -58,6 +58,7 @@
             """
             return self.assertRaisesRegexp(*args, **kwargs)
 
+    if not hasattr(unittest.TestCase, 'assertRegex'):
         def assertRegex(self, *args, **kwargs):
             """
             Wrapper of unittest.assertRegexpMatches for Python 2 unittest.

-- 
To view, visit https://gerrit.wikimedia.org/r/169645
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1022d27fcecdc516b3ebf42dc3380458163b2aa4
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to