jenkins-bot has submitted this change and it was merged.
Change subject: Fix missing i18n git submodule on Python 3
......................................................................
Fix missing i18n git submodule on Python 3
Avoid implicit namespace package in messages_available()
and twget_keys().
Raise OSError in twget_keys() when i18n can not be loaded.
Bug: T110174
Change-Id: I7454bb13d499661e1467227e06a3d57286cb1dd0
---
M pywikibot/i18n.py
1 file changed, 8 insertions(+), 2 deletions(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index de78688..9607c87 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -81,8 +81,12 @@
if _messages_available is not None:
return _messages_available
try:
- __import__(_messages_package_name)
+ mod = __import__(_messages_package_name, fromlist=[str('__path__')])
except ImportError:
+ _messages_available = False
+ return False
+
+ if not os.listdir(next(iter(mod.__path__))):
_messages_available = False
return False
@@ -612,11 +616,13 @@
Return all language codes for a special message.
@param twtitle: The TranslateWiki string title, in <package>-<key> format
+
+ @raises OSError: the package i18n can not be loaded
"""
# obtain the directory containing all the json files for this package
package = twtitle.split("-")[0]
mod = __import__(_messages_package_name, fromlist=[str('__file__')])
- pathname = os.path.join(os.path.dirname(mod.__file__), package)
+ pathname = os.path.join(next(iter(mod.__path__)), package)
# build a list of languages in that directory
langs = [filename.partition('.')[0]
--
To view, visit https://gerrit.wikimedia.org/r/233688
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7454bb13d499661e1467227e06a3d57286cb1dd0
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: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Use oauth on beta en.wp and add beta en.ws
......................................................................
Use oauth on beta en.wp and add beta en.ws
Using oauth on beta sites means the 'Pywikibot-test' password
does not need to be used on those sites, which is discouraged as
the beta sites are not secure environments.
Adds oauth to beta en.wp to run user tests on the largest beta site,
providing better coverage on beta sites without a password.
Add beta en.ws to the text matrix, not running user tests,
hoping to catch any bugs on beta when oauth is not enabled.
One test fails on beta en.ws due to the interwiki map (T69931).
Bug: T100797
Change-Id: I607ec16288540d8b6375114ea1ac18e50e6c4828
---
M .travis.yml
M tests/site_tests.py
2 files changed, 10 insertions(+), 2 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 dc18b33..7a60b58 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -53,6 +53,9 @@
- if [[ $FAMILY == 'wpbeta' ]]; then
python -m generate_family_file 'http://'$LANGUAGE'.wikipedia.beta.wmflabs.org/' 'wpbeta' 'y' ;
fi
+ - if [[ $FAMILY == 'wsbeta' ]]; then
+ python -m generate_family_file 'http://'$LANGUAGE'.wikisource.beta.wmflabs.org/' 'wsbeta' 'y' ;
+ fi
- python -W error::UserWarning -m generate_user_files -dir:~/.pywikibot/ -family:$FAMILY -lang:$LANGUAGE -v -user:"$PYWIKIBOT2_USERNAME"
@@ -112,9 +115,11 @@
- python: '2.7_with_system_site_packages' # equivalent to virtualenv: system_site_packages: true
env: LANGUAGE=he FAMILY=wikivoyage SITE_ONLY=1
- python: '2.7'
- env: LANGUAGE=en FAMILY=wpbeta SITE_ONLY=1
- - python: '3.4'
+ env: LANGUAGE=en FAMILY=wpbeta SITE_ONLY=1 OAUTH_DOMAIN="en.wikipedia.beta.wmflabs.org"
+ - python: '3.3'
env: LANGUAGE=zh FAMILY=wpbeta SITE_ONLY=1 OAUTH_DOMAIN="zh.wikipedia.beta.wmflabs.org"
+ - python: '3.4'
+ env: LANGUAGE=en FAMILY=wsbeta SITE_ONLY=1
- python: '2.7'
env: LANGUAGE=wikia FAMILY=wikia PYWIKIBOT2_TEST_NO_RC=1
- python: '3.3'
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 898f094..533c7b7 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -559,6 +559,9 @@
def testAllLinks(self):
"""Test the site.alllinks() method."""
+ if self.site.family.name == 'wsbeta':
+ raise unittest.SkipTest('Test fails on betawiki; T69931')
+
mysite = self.get_site()
fwd = list(mysite.alllinks(total=10))
self.assertLessEqual(len(fwd), 10)
--
To view, visit https://gerrit.wikimedia.org/r/233341
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I607ec16288540d8b6375114ea1ac18e50e6c4828
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: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
XZise has submitted this change and it was merged.
Change subject: Assert user() is not None
......................................................................
Assert user() is not None
Also re-login during test tearDown.
Bug: T109946
Change-Id: I842dce901f7c18bd745a86e2e9a21f1e7ef6a14b
---
M tests/aspects.py
1 file changed, 9 insertions(+), 0 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/aspects.py b/tests/aspects.py
index de3ca79..f855e53 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -615,7 +615,15 @@
Login to the site if it is not logged in.
"""
super(RequireUserMixin, self).setUp()
+ self._reset_login()
+ def tearDown(self):
+ """Log back into the site."""
+ super(RequireUserMixin, self).tearDown()
+ self._reset_login()
+
+ def _reset_login(self):
+ """Login to all sites."""
sysop = hasattr(self, 'sysop') and self.sysop
# There may be many sites, and setUp doesnt know
@@ -629,6 +637,7 @@
if not site.logged_in(sysop):
site.login(sysop)
+ assert(site.user())
def get_userpage(self, site=None):
"""Create a User object for the user's userpage."""
--
To view, visit https://gerrit.wikimedia.org/r/233187
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I842dce901f7c18bd745a86e2e9a21f1e7ef6a14b
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: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] i18n_tests: fixed a typo in a comment
......................................................................
[FIX] i18n_tests: fixed a typo in a comment
Change-Id: I60da5dddaaef848d519846883af1a231bdc681ad
---
M tests/i18n_tests.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/i18n_tests.py b/tests/i18n_tests.py
index 148e953..69ac9f1 100644
--- a/tests/i18n_tests.py
+++ b/tests/i18n_tests.py
@@ -133,7 +133,7 @@
if not isinstance(cls.message_package, basestring):
raise TypeError('%s.message_package must be a package name'
% cls.__name__)
- # Th call to set_messages_package below exists only to confirm
+ # The call to set_messages_package below exists only to confirm
# that the package exists and messages are available, so
# that tests can be skipped if the i18n data doesnt exist.
cls.orig_messages_package_name = i18n._messages_package_name
--
To view, visit https://gerrit.wikimedia.org/r/233939
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I60da5dddaaef848d519846883af1a231bdc681ad
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: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: jenkins-bot <>