XZise has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/169645

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/45/169645/1

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: newchange
Gerrit-Change-Id: I1022d27fcecdc516b3ebf42dc3380458163b2aa4
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <[email protected]>

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

Reply via email to