jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/509620 )

Change subject: [tests] deprecate allowed_failure and allowed_failure_if
......................................................................

[tests] deprecate allowed_failure and allowed_failure_if

Also use unittest.expectedFailure in favour of the wrapper function
for Python 2 because TestResult.wasSuccessful() count usexprected success
as a successful test.

Bug: T223030
Change-Id: I18de0bc29d0506bdb447085c30e2a4fca4136608
---
M tests/utils.py
1 file changed, 8 insertions(+), 1 deletion(-)

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



diff --git a/tests/utils.py b/tests/utils.py
index 3b69183..f27b298 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -36,6 +36,7 @@
 from pywikibot.data.api import Request as _original_Request
 from pywikibot.site import Namespace
 from pywikibot.tools import (
+    deprecated,
     PY2, PYTHON_VERSION,
     UnicodeType as unicode,
 )
@@ -70,6 +71,7 @@
         return lambda orig: orig


+@deprecated('unittest.expectedFailure', since='20190512')
 def allowed_failure(func):
     """
     Unit test decorator to allow failure.
@@ -96,9 +98,14 @@
             pywikibot.exception(tb=True)
             raise unittest.SkipTest('Test is allowed to fail.')
     wrapper.__name__ = func.__name__
-    return wrapper
+
+    if PY2:
+        return unittest.expectedFailure(func)
+    else:
+        return wrapper


+@deprecated('expected_failure_if', since='20190512')
 def allowed_failure_if(expect):
     """
     Unit test decorator to allow failure under conditions.

--
To view, visit https://gerrit.wikimedia.org/r/509620
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I18de0bc29d0506bdb447085c30e2a4fca4136608
Gerrit-Change-Number: 509620
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to