Dalba has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/342319 )
Change subject: site_detect_tests.py: Skip tests on ServerError and Timeout
......................................................................
site_detect_tests.py: Skip tests on ServerError and Timeout
These two error types used to be skipped before 917c7e115e9a8749386ad.
This change brings back that behaviour and removes _retry_few_times
logic which seems unnecessary. We have 13 builds which run these tests
which can be considered some form of _retry_few_times.
Bug: T160268
Change-Id: Ifb3592d565013b9998265993ebe3ae92f0cd78fe
---
M tests/site_detect_tests.py
1 file changed, 2 insertions(+), 32 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/19/342319/1
diff --git a/tests/site_detect_tests.py b/tests/site_detect_tests.py
index c808b0a..15616ea 100644
--- a/tests/site_detect_tests.py
+++ b/tests/site_detect_tests.py
@@ -19,34 +19,6 @@
__version__ = '$Id$'
-def _retry_few_times(retry_limit):
- """
- Decorator to retry test on failure.
-
- Swallow AssertionError retry_limit times before failing test.
-
- @param retry_limit: Retry limit before failing test
- @type retry_limit: int
- @return: a decorator to retry test on failure
- @rtype: function
- @raises AssertionError: all retries of test failed
- """
- def actual_decorator(wrapped_func):
- def wrapper_func(*args, **kwargs):
- for retry_no in range(1, retry_limit + 1):
- try:
- wrapped_func(*args, **kwargs)
- except AssertionError:
- if retry_no == retry_limit:
- raise
- except:
- raise
- else:
- return
- return wrapper_func
- return actual_decorator
-
-
class SiteDetectionTestCase(TestCase):
"""Testcase for MediaWiki detection and site object creation."""
@@ -63,9 +35,8 @@
"""
try:
self.assertIsInstance(MWSite(url), MWSite)
- except (AttributeError, ConnectionError, RuntimeError, ServerError,
- Timeout):
- raise AssertionError
+ except (ServerError, Timeout) as e:
+ self.skipTest(e)
def assertNoSite(self, url):
"""
@@ -100,7 +71,6 @@
"""Test detection of MediaWiki sites for en.citizendium.org."""
self.assertSite('http://en.citizendium.org/wiki/$1')
- @_retry_few_times(10)
def test_wikichristian(self):
"""Test detection of MediaWiki sites for www.wikichristian.org.
--
To view, visit https://gerrit.wikimedia.org/r/342319
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb3592d565013b9998265993ebe3ae92f0cd78fe
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dalba <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits