Build Update for jayvdb/pywikibot-core
-------------------------------------
Build: #142
Status: Passed
Duration: 28 minutes and 34 seconds
Commit: 1afc127 (review/john_vandenberg/test-skip-network-problems)
Author: John Vandenberg
Message: Skip tests that use a site which is failing
Add 'hostname' to TestCase.sites dict, and skip class when
failed to receive a useful response for the hosts homepage.
Fix threadedhttp.HttpRequest object to handle socket timeouts,
where the exception needs to be thrown if the raw response was
fetched.
Re-enable weblib tests on travis-ci, instead using the new
automatic skip functionality to avoid errors due to WebCite
serving invalid XML and having an undecodable homepage.
Bug: T58963
Change-Id: I8fdcdaa0fab3b680d35b81b20a12ff5b786f779d
View the changeset: https://github.com/jayvdb/pywikibot-core/commit/1afc127498bf
View the full build log and details: https://travis-ci.org/jayvdb/pywikibot-core/builds/43334999
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
Build Update for jayvdb/pywikibot-core
-------------------------------------
Build: #140
Status: Fixed
Duration: 35 minutes and 28 seconds
Commit: 01fd7d4 (review/john_vandenberg/test-skip-network-problems)
Author: John Vandenberg
Message: Skip tests that use a site which is failing
Add 'hostname' to TestCase.sites dict, and skip class when
failed to receive a useful response for the hosts homepage.
Fix threadedhttp.HttpRequest object to handle socket timeouts,
where the exception needs to be thrown if the raw response was
fetched.
Re-enable weblib tests on travis-ci, instead using the new
automatic skip functionality to avoid errors due to WebCite
serving invalid XML and having an undecodable homepage.
Bug: T58963
Change-Id: I8fdcdaa0fab3b680d35b81b20a12ff5b786f779d
View the changeset: https://github.com/jayvdb/pywikibot-core/commit/01fd7d48468b
View the full build log and details: https://travis-ci.org/jayvdb/pywikibot-core/builds/43324638
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
Build Update for jayvdb/pywikibot-core
-------------------------------------
Build: #139
Status: Still Failing
Duration: 30 minutes and 23 seconds
Commit: 832bf06 (review/john_vandenberg/test-skip-network-problems)
Author: John Vandenberg
Message: Skip tests that use a site which is failing
Add 'hostname' to TestCase.sites dict, and skip class when
failed to receive a useful response for the hosts homepage.
Fix threadedhttp.HttpRequest object to handle socket timeouts,
where the exception needs to be thrown if the raw response was
fetched.
Re-enable weblib tests on travis-ci, instead using the new
automatic skip functionality to avoid errors due to WebCite
serving invalid XML and having an undecodable homepage.
Bug: T58963
Change-Id: I8fdcdaa0fab3b680d35b81b20a12ff5b786f779d
View the changeset: https://github.com/jayvdb/pywikibot-core/commit/832bf0665b36
View the full build log and details: https://travis-ci.org/jayvdb/pywikibot-core/builds/43321527
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
Build Update for jayvdb/pywikibot-core
-------------------------------------
Build: #138
Status: Still Failing
Duration: 39 minutes and 32 seconds
Commit: 3bb5688 (review/john_vandenberg/test-skip-network-problems)
Author: John Vandenberg
Message: Skip tests that use a site which is failing
Add 'hostname' to TestCase.sites dict, and skip class when
failed to receive a useful response for the hosts homepage.
Fix threadedhttp.HttpRequest object to handle socket timeouts,
where the exception needs to be thrown if the raw response was
fetched.
Re-enable weblib tests on travis-ci, instead using the new
automatic skip functionality to avoid errors due to WebCite
serving invalid XML and having an undecodable homepage.
Bug: T58963
Change-Id: I8fdcdaa0fab3b680d35b81b20a12ff5b786f779d
View the changeset: https://github.com/jayvdb/pywikibot-core/commit/3bb568885d7d
View the full build log and details: https://travis-ci.org/jayvdb/pywikibot-core/builds/43308397
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
Build Update for jayvdb/pywikibot-core
-------------------------------------
Build: #137
Status: Failed
Duration: 42 minutes and 52 seconds
Commit: 5f57cfd (review/john_vandenberg/test-skip-network-problems)
Author: John Vandenberg
Message: Skip tests that use a site which is failing
Add 'hostname' to TestCase.sites dict, and skip class when
failed to receive a useful response for the hosts homepage.
Fix threadedhttp.HttpRequest object to handle socket timeouts,
where the exception needs to be thrown if the raw response was
fetched.
Re-enable weblib tests on travis-ci, instead using the new
automatic skip functionality to avoid errors due to WebCite
serving invalid XML and having an undecodable homepage.
Bug: T58963
Change-Id: I8fdcdaa0fab3b680d35b81b20a12ff5b786f779d
View the changeset: https://github.com/jayvdb/pywikibot-core/commit/5f57cfd24755
View the full build log and details: https://travis-ci.org/jayvdb/pywikibot-core/builds/43302206
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #1763
Status: Still Failing
Duration: 33 minutes and 6 seconds
Commit: 37a9ea8 (master)
Author: John Vandenberg
Message: Run only site tests on fr.wikt and test.wd
Use nosetests with attribute selectors to only run tests which
will only use the site in the matrix.
Bug: T70671
Change-Id: I60f4b87ff414ba9ab32abc39bf2a90801056c8a5
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/fca702e7a2f9...37a9ea87…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/43287281
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
jenkins-bot has submitted this change and it was merged.
Change subject: Run only site tests on fr.wikt and test.wd
......................................................................
Run only site tests on fr.wikt and test.wd
Use nosetests with attribute selectors to only run tests which
will only use the site in the matrix.
Bug: T70671
Change-Id: I60f4b87ff414ba9ab32abc39bf2a90801056c8a5
---
M .travis.yml
1 file changed, 14 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.travis.yml b/.travis.yml
index 019338c..c708c6a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,6 +10,7 @@
- sudo apt-get install -y liblua5.1-dev
install:
+ - if [[ "$SITE_ONLY" == '1' ]]; then export USE_NOSE=1; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install ordereddict unittest2==0.6.0; fi
- pip install six
- export GITHUB_USER=`echo $TRAVIS_REPO_SLUG | cut -d '/' -f 1`
@@ -27,6 +28,7 @@
- echo "max_retries = 2" >> ~/.pywikibot/user-config.py
- echo "maximum_GET_length = 5000" >> ~/.pywikibot/user-config.py
+ - echo "console_encoding = 'utf8'" >> ~/.pywikibot/user-config.py
- if [[ "$GITHUB_USER" == "wikimedia" ]]; then PYWIKIBOT2_USERNAME="Pywikibot-test"; fi
@@ -44,7 +46,16 @@
- python -c "import setuptools; print(setuptools.__version__)"
script:
- - if [[ "$USE_NOSE" == "1" ]]; then nosetests -v ; else python setup.py test; fi
+ - if [[ "$USE_NOSE" == "1" ]]; then
+ if [[ "$SITE_ONLY" == "1" ]]; then
+ echo "Running site tests only code ${LANGUAGE} on family ${FAMILY}" ;
+ nosetests tests -v -a "family=$FAMILY,code=$LANGUAGE" ;
+ else
+ nosetests tests -v ;
+ fi ;
+ else
+ python setup.py test ;
+ fi
env:
global:
@@ -56,8 +67,8 @@
matrix:
- LANGUAGE=en FAMILY=wikipedia
- LANGUAGE=ar FAMILY=wikipedia PYSETUP_TEST_EXTRAS=1
- - LANGUAGE=test FAMILY=wikidata
- - LANGUAGE=fr FAMILY=wiktionary
+ - LANGUAGE=test FAMILY=wikidata SITE_ONLY=1
+ - LANGUAGE=fr FAMILY=wiktionary SITE_ONLY=1
notifications:
email:
--
To view, visit https://gerrit.wikimedia.org/r/178070
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I60f4b87ff414ba9ab32abc39bf2a90801056c8a5
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
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: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #1762
Status: Broken
Duration: 39 minutes and 34 seconds
Commit: fca702e (master)
Author: John Vandenberg
Message: test decorator allowed_failure
Test runners each have different interpretations of what should be
the result of an @expectedFailure test if it succeeds. Some
consider it to be a pass; others a failure.
This new decorator runs the test and, if it is a failure, reports the
failure and considers it a skipped test.
Change-Id: Ia87dda2780a9fe4130b2820298f07f983d5db80b
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/df6e5189616f...fca702e7…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/43274873
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
jenkins-bot has submitted this change and it was merged.
Change subject: test decorator allowed_failure
......................................................................
test decorator allowed_failure
Test runners each have different interpretations of what should be
the result of an @expectedFailure test if it succeeds. Some
consider it to be a pass; others a failure.
This new decorator runs the test and, if it is a failure, reports the
failure and considers it a skipped test.
Change-Id: Ia87dda2780a9fe4130b2820298f07f983d5db80b
---
M tests/api_tests.py
M tests/http_tests.py
M tests/site_tests.py
M tests/utils.py
4 files changed, 48 insertions(+), 13 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/api_tests.py b/tests/api_tests.py
index 9746229..bf43d3a 100644
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -19,6 +19,7 @@
DefaultSiteTestCase,
DefaultDrySiteTestCase,
)
+from tests.utils import allowed_failure
class TestApiFunctions(DefaultSiteTestCase):
@@ -395,7 +396,7 @@
count += 1
self.assertEqual(len(links), count)
- @unittest.expectedFailure
+ @allowed_failure
def test_many_continuations_limited(self):
mainpage = self.get_mainpage()
links = list(self.site.pagelinks(mainpage, total=30))
@@ -419,7 +420,7 @@
self.assertEqual(len(links), count)
# FIXME: AssertionError: 30 != 6150
- @unittest.expectedFailure
+ @allowed_failure
def test_two_continuations_limited(self):
# FIXME: test fails
mainpage = self.get_mainpage()
diff --git a/tests/http_tests.py b/tests/http_tests.py
index 0263d62..55698a5 100644
--- a/tests/http_tests.py
+++ b/tests/http_tests.py
@@ -13,7 +13,7 @@
from pywikibot.comms import http, threadedhttp
from pywikibot import config2 as config
from tests.aspects import unittest, TestCase
-from tests.utils import expectedFailureIf
+from tests.utils import expected_failure_if
if sys.version_info[0] > 2:
import queue as Queue
@@ -66,7 +66,7 @@
site=None,
uri='https://www.omegawiki.org/')
- @expectedFailureIf(sys.version_info[0] > 2) # bug 72236
+ @expected_failure_if(sys.version_info[0] > 2) # bug 72236
def test_https_ignore_cert_error(self):
"""Test http request function ignoring ssl bad certificate."""
# As the connection is cached, the above test will cause
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 5d7a964..4b56794 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -19,7 +19,6 @@
from pywikibot.tools import MediaWikiVersion as LV
from pywikibot.data import api
-from tests.utils import expectedFailureIf
from tests.aspects import (
unittest, TestCase,
DefaultSiteTestCase,
@@ -27,6 +26,7 @@
WikidataTestCase,
DefaultWikidataClientTestCase,
)
+from tests.utils import allowed_failure, allowed_failure_if
if sys.version_info[0] > 2:
basestring = (str, )
@@ -678,7 +678,7 @@
self.assertIsInstance(using, pywikibot.Page)
self.assertIn(imagepage, list(using.imagelinks()))
- @expectedFailureIf(os.environ.get('TRAVIS', 'false') == 'true')
+ @allowed_failure_if(os.environ.get('TRAVIS', 'false') == 'true')
def test_image_usage_in_redirects(self):
"""Test the site.imageusage() method on redirects only."""
mysite = self.get_site()
@@ -1772,7 +1772,7 @@
if count > 5:
break
- @unittest.expectedFailure
+ @allowed_failure
def test_preload_langlinks_normal(self):
"""Test preloading continuation works."""
# FIXME: test fails
@@ -1792,7 +1792,7 @@
if count >= 6:
break
- @unittest.expectedFailure
+ @allowed_failure
def test_preload_langlinks_count(self):
"""Test preloading continuation works."""
# FIXME: test fails
@@ -1834,7 +1834,7 @@
self.assertEqual(len(links), count)
- @unittest.expectedFailure
+ @allowed_failure
def test_preload_templates(self):
"""Test preloading templates works."""
mysite = self.get_site()
@@ -1854,7 +1854,7 @@
if count >= 6:
break
- @unittest.expectedFailure
+ @allowed_failure
def test_preload_templates_and_langlinks(self):
"""Test preloading templates and langlinks works."""
mysite = self.get_site()
diff --git a/tests/utils.py b/tests/utils.py
index c932e59..afb68eb 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -8,6 +8,7 @@
from __future__ import print_function
__version__ = '$Id$'
#
+
import pywikibot
from pywikibot.tools import SelfCallDict
from pywikibot.site import Namespace
@@ -24,15 +25,48 @@
PywikibotTestCase = aspects.TestCase
-def expectedFailureIf(expect):
+def expected_failure_if(expect):
"""
- Unit test decorator to expect/allow failure under conditions.
+ Unit test decorator to expect failure under conditions.
+
+ @param expect: Flag to check if failure is expected
+ @type expect: bool
+ """
+ if expect:
+ return unittest.expectedFailure
+ else:
+ return lambda orig: orig
+
+
+def allowed_failure(func):
+ """
+ Unit test decorator to allow failure.
+
+ Test runners each have different interpretations of what should be
+ the result of an @expectedFailure test if it succeeds. Some consider
+ it to be a pass; others a failure.
+
+ This decorator runs the test and, if it is a failure, reports the result
+ and considers it a skipped test.
+ """
+ def wrapper(*args, **kwargs):
+ try:
+ func(*args, **kwargs)
+ except Exception:
+ pywikibot.exception(tb=True)
+ raise unittest.SkipTest()
+ return wrapper
+
+
+def allowed_failure_if(expect):
+ """
+ Unit test decorator to allow failure under conditions.
@param expect: Flag to check if failure is allowed
@type expect: bool
"""
if expect:
- return unittest.expectedFailure
+ return allowed_failure
else:
return lambda orig: orig
--
To view, visit https://gerrit.wikimedia.org/r/178069
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia87dda2780a9fe4130b2820298f07f983d5db80b
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
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: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>