jenkins-bot has submitted this change and it was merged.
Change subject: set default userinterface_lang in config
......................................................................
set default userinterface_lang in config
Allow userinterface_lang to be used elsewhere in pywikibot
Change-Id: I3abc73ec1c463352a2eed8a71817a630db0a55c4
---
M pywikibot/config2.py
M pywikibot/i18n.py
2 files changed, 7 insertions(+), 6 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index dbb1c28..60e6740 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -29,6 +29,7 @@
import stat
import sys
+from locale import getdefaultlocale
from warnings import warn
from pywikibot.tools import default_encoding
@@ -909,6 +910,9 @@
# Fix up default console_encoding
console_encoding = default_encoding(console_encoding)
+if userinterface_lang is None:
+ userinterface_lang = getdefaultlocale()[0].split('_')[0]
+
# Fix up transliteration_target
if transliteration_target == 'not set':
if sys.platform == 'win32':
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index 2fff519..4d19b4f 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -28,7 +28,6 @@
import sys
import re
-import locale
import warnings
from pywikibot import Error
@@ -617,9 +616,8 @@
"""
Ask the user a question, return the user's answer.
- The prompt message is retrieved via L{twtranslate} and either uses the
- config variable 'userinterface_lang' or the default locale as the language
- code.
+ The prompt message is retrieved via L{twtranslate} and uses the
+ config variable 'userinterface_lang'.
@param twtitle: The TranslateWiki string title, in <package>-<key> format
@param parameters: The values which will be applied to the translated text
@@ -635,8 +633,7 @@
else:
prompt = fallback_prompt
else:
- code = config.userinterface_lang or \
- locale.getdefaultlocale()[0].split('_')[0]
+ code = config.userinterface_lang
prompt = twtranslate(code, twtitle, parameters)
return pywikibot.input(prompt, password)
--
To view, visit https://gerrit.wikimedia.org/r/203506
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3abc73ec1c463352a2eed8a71817a630db0a55c4
Gerrit-PatchSet: 1
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: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: jenkins-bot <>
XZise has submitted this change and it was merged.
Change subject: Do not use git.wikimedia.org for httplib2
......................................................................
Do not use git.wikimedia.org for httplib2
git.wikimedia.org isnt always up and isnt needed.
Change-Id: Ib4cd47b77fe8ec0a479cf6299de43d2ecdb0a32a
---
M setup.py
1 file changed, 0 insertions(+), 1 deletion(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/setup.py b/setup.py
index b65d7c1..b36244a 100644
--- a/setup.py
+++ b/setup.py
@@ -55,7 +55,6 @@
script_deps['script_wui.py'] = [irc_dep, 'lunatic-python', 'crontab']
dependency_links = [
- 'https://git.wikimedia.org/zip/?r=pywikibot/externals/httplib2.git&format=gz…',
'git+https://github.com/AlereDevices/lunatic-python.git#egg=lunatic-python',
]
--
To view, visit https://gerrit.wikimedia.org/r/203791
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib4cd47b77fe8ec0a479cf6299de43d2ecdb0a32a
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: 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: #2128
Status: Errored
Duration: 59 minutes and 45 seconds
Commit: c224768 (master)
Author: John Vandenberg
Message: Use str() for environment variables in utils.execute
Python 2 subprocess _execute_child raises TypeError
when the env parameter contains unicode.
Change-Id: Ia3aa6bde907ecbde96ac2de3785e48ce71a6d970
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/420db5775340...c2247685…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/58246880
--
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: Use str() for environment variables in utils.execute
......................................................................
Use str() for environment variables in utils.execute
Python 2 subprocess _execute_child raises TypeError
when the env parameter contains unicode.
Change-Id: Ia3aa6bde907ecbde96ac2de3785e48ce71a6d970
---
M tests/utils.py
1 file changed, 4 insertions(+), 2 deletions(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/utils.py b/tests/utils.py
index 8aeb071..d23fd91 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -256,15 +256,17 @@
@param command: executable to run and arguments to use
@type command: list of unicode
"""
+ # Any environment variables added on Windows must be of type
+ # str() on Python 2.
env = os.environ.copy()
# sys.path may have been modified by the test runner to load dependencies.
env['PYTHONPATH'] = ":".join(sys.path)
# LC_ALL is used by i18n.input as an alternative for userinterface_lang
if pywikibot.config.userinterface_lang:
- env['LC_ALL'] = pywikibot.config.userinterface_lang
+ env['LC_ALL'] = str(pywikibot.config.userinterface_lang)
# Set EDITOR to an executable that ignores all arguments and does nothing.
if sys.platform == 'win32':
- env['EDITOR'] = 'call'
+ env['EDITOR'] = str('call')
else:
env['EDITOR'] = 'true'
options = {
--
To view, visit https://gerrit.wikimedia.org/r/203782
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia3aa6bde907ecbde96ac2de3785e48ce71a6d970
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 <>
jenkins-bot has submitted this change and it was merged.
Change subject: RC tests: Use en.wp instead of test.wd or test.wp
......................................................................
RC tests: Use en.wp instead of test.wd or test.wp
If a travis build has not been set up with a username,
pywikibot will default to using test.wikipedia as the test site.
Builds against Wikimedia 'test' sites can be effectively halted
waiting for three edits to appear on the live RC feed.
Also change RepeatingGenerator RC tests to use default site,
unless it is a test site.
Change-Id: I94f569d9f40a2ed43d45f4ab11c8cb9e25bbd4bd
---
M tests/aspects.py
M tests/pagegenerators_tests.py
2 files changed, 36 insertions(+), 21 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 1fb1728..78cd606 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -930,6 +930,23 @@
family = config.family
code = config.mylang
+ @classmethod
+ def override_default_site(cls, site):
+ print('%s using %s instead of %s:%s.'
+ % (cls.__name__, site, cls.family, cls.code))
+ cls.site = site
+ cls.family = site.family.name
+ cls.code = site.code
+
+ cls.sites = {
+ cls.site: {
+ 'family': cls.family,
+ 'code': cls.code,
+ 'site': cls.site,
+ 'hostname': cls.site.hostname(),
+ }
+ }
+
class AlteredDefaultSiteTestCase(TestCase):
@@ -995,19 +1012,7 @@
site = cls.get_site()
if not isinstance(site.family, WikimediaFamily):
- print('%s using English Wikipedia instead of non-WMF config.family %s.'
- % (cls.__name__, cls.family))
- cls.family = 'wikipedia'
- cls.code = 'en'
- cls.site = pywikibot.Site('en', 'wikipedia')
- cls.sites = {
- cls.site: {
- 'family': 'wikipedia',
- 'code': 'en',
- 'site': cls.site,
- 'hostname': cls.site.hostname(),
- }
- }
+ cls.override_default_site(pywikibot.Site('en', 'wikipedia'))
class WikibaseTestCase(TestCase):
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 7269493..7a160b4 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -232,30 +232,37 @@
self.assertEqual(len(list(gen)), 0)
-class TestRepeatingGenerator(TestCase):
+class TestRepeatingGenerator(WikimediaDefaultSiteTestCase):
"""Test RepeatingGenerator."""
- family = 'wikipedia'
- code = 'en'
+ # site.recentchanges() includes external edits from wikidata,
+ # except on wiktionaries which are not linked to wikidata
+ # so total=3 should not be too high for most sites.
+ length = 3
+
+ @classmethod
+ def setUpClass(cls):
+ super(TestRepeatingGenerator, cls).setUpClass()
+
+ if cls.get_site().code == 'test':
+ cls.override_default_site(pywikibot.Site('en', 'wikipedia'))
def test_RepeatingGenerator(self):
- # site.recentchanges() includes external edits (from wikidata),
- # so total=4 is not too high
items = list(
pagegenerators.RepeatingGenerator(self.site.recentchanges,
key_func=lambda x: x['revid'],
sleep_duration=10,
reverse=True,
namespaces=[0],
- total=4)
+ total=self.length)
)
- self.assertEqual(len(items), 4)
+ self.assertEqual(len(items), self.length)
timestamps = [pywikibot.Timestamp.fromISOformat(item['timestamp'])
for item in items]
self.assertEqual(sorted(timestamps), timestamps)
self.assertTrue(all(item['ns'] == 0 for item in items))
- self.assertEqual(len(set(item['revid'] for item in items)), 4)
+ self.assertEqual(len(set(item['revid'] for item in items)), self.length)
class TestTextfilePageGenerator(DefaultSiteTestCase):
@@ -838,6 +845,9 @@
'socketIO_client %s not supported by Wikimedia-Stream'
% socketIO_client.__version__)
+ if cls.get_site().code == 'test':
+ cls.override_default_site(pywikibot.Site('en', 'wikipedia'))
+
def test_RC_pagegenerator_result(self):
import logging
lgr = logging.getLogger('socketIO_client')
--
To view, visit https://gerrit.wikimedia.org/r/203629
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I94f569d9f40a2ed43d45f4ab11c8cb9e25bbd4bd
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 <>
jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] ui_tests: Use str name
......................................................................
[FIX] ui_tests: Use str name
The name for the registration must be a str but with unicode_literals
from 1e54a7d6 this is unicode in Python 2.
Change-Id: I9d3ba7c812d87ef196d302dab3c3d2d2a8d3bda7
---
M tests/ui_tests.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index 20e8204..3a3388c 100644
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -115,7 +115,7 @@
pass
- pywikibotManager.register('pywikibot', pywikibotWrapper)
+ pywikibotManager.register(str('pywikibot'), pywikibotWrapper)
_manager = pywikibotManager(address=("127.0.0.1", 47228), authkey="4DJSchgwy5L5JxueZEWbxyeG")
if len(sys.argv) > 1 and sys.argv[1] == "--run-as-slave-interpreter":
s = _manager.get_server()
--
To view, visit https://gerrit.wikimedia.org/r/203657
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9d3ba7c812d87ef196d302dab3c3d2d2a8d3bda7
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 <>