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 <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>