jenkins-bot has submitted this change and it was merged.
Change subject: Delay import of win32clipboard
......................................................................
Delay import of win32clipboard
Under python 2.7.8 on Windows, the default test loader for 'tests' tries
to instantiate a module for each file called '*_tests.py', which fails
for the module 'ui_tests' when pywin32 is not installed. This causes a
backtrace in setup.py before testing commences. ui_tests is not part of
the normal test suite; instead of testing, it prints a message saying it
must be run outside of the test suite.
pywin32 does not appear easy to set as a test dependency, as setup fails
to find a suitable egg to build, and pywin32 doesnt provide a pypi
package, wheel binary packages, etc.
Moving the import to the code which uses win32clipboard allows the module
to be instantiated, so it can report a test skip message during testing.
This change allows the tests to be run on MS Windows without
pywin32 or pywinauto installed.
Bug: 68847
Change-Id: I507acbde9f682b9a92a902e9ce22a8d6a64ca583
---
M tests/ui_tests.py
1 file changed, 4 insertions(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index c072d32..991460f 100644
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -44,7 +44,6 @@
if os.name == "nt":
from multiprocessing.managers import BaseManager
import threading
- import win32clipboard
class pywikibotWrapper(object):
def init(self):
@@ -395,11 +394,15 @@
time.sleep(0.01)
def setclip(self, text):
+ import win32clipboard
+
win32clipboard.OpenClipboard()
win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT, unicode(text))
win32clipboard.CloseClipboard()
def getclip(self):
+ import win32clipboard
+
win32clipboard.OpenClipboard()
data = win32clipboard.GetClipboardData(win32clipboard.CF_UNICODETEXT)
win32clipboard.CloseClipboard()
--
To view, visit https://gerrit.wikimedia.org/r/150508
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I507acbde9f682b9a92a902e9ce22a8d6a64ca583
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: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: expand wikicode in 'Cite_error_refs_without_references_category'
......................................................................
expand wikicode in 'Cite_error_refs_without_references_category'
The English Wikipedia version of the message invokes a Scribunto
module, thus making noreferences.py fail with pywikibot.InvalidTitle
(because of the curly brackets in it) when called with no arguments:
https://travis-ci.org/wikimedia/pywikibot-core/jobs/31712965
Ideally, the 'amenableparser' argument should be passed to the
allmessages API, but APISite.mediawiki_messages() doesn't have this
feature yet.
Change-Id: I88b4beeec0bc64e2586a6165bf6ae9d70522db5d
---
M scripts/noreferences.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/noreferences.py b/scripts/noreferences.py
index e92ac82..718a47d 100755
--- a/scripts/noreferences.py
+++ b/scripts/noreferences.py
@@ -678,7 +678,8 @@
if not gen:
site = pywikibot.Site()
try:
- cat = site.mediawiki_message(maintenance_category)
+ cat = site.expand_text(
+ site.mediawiki_message(maintenance_category))
except:
pass
else:
--
To view, visit https://gerrit.wikimedia.org/r/151859
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I88b4beeec0bc64e2586a6165bf6ae9d70522db5d
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisamoa(a)openmailbox.org>
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 <>
jenkins-bot has submitted this change and it was merged.
Change subject: move string properties normalization into WikibasePage#__normalizeData()
......................................................................
move string properties normalization into WikibasePage#__normalizeData()
away from editLabels, editDescriptions and editAliases,
thus allowing to call it from other functions
== use cases ==
currently, to edit some labels, the only valid syntaxes are:
* editLabels({'lang': 'val'})
* editEntity({'labels': {'lang': {'language': 'lang', 'value': 'val'}}})
this change adds the following possibilities:
* editLabels({'lang': {'language': 'lang', 'value': 'val'}})
* editEntity({'labels': {'lang': 'val'}})
Change-Id: Iba1fdce1cc199cda0b7f83febdf48ce6a11100e0
---
M pywikibot/page.py
1 file changed, 17 insertions(+), 9 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 2232a49..cf6f367 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2740,6 +2740,20 @@
del data[key]
return data
+ def __normalizeData(self, data):
+ for prop in ('labels', 'descriptions', 'aliases'):
+ if prop in data:
+ data[prop] = self.__normalizeLanguages(data[prop])
+ if prop == 'aliases':
+ for key, values in data[prop].iteritems():
+ for index, value in enumerate(values):
+ data[prop][key][index] = {'language': key,
+ 'value': value}
+ else:
+ for key, value in data[prop].iteritems():
+ data[prop][key] = {'language': key, 'value': value}
+ return data
+
def getdbName(self, site):
"""
Helper function to obtain a dbName for a Site.
@@ -2768,6 +2782,9 @@
baserevid = self.lastrevid
else:
baserevid = None
+
+ data = self.__normalizeData(data)
+
updates = self.repo.editEntity(self._defined_by(singular=True), data,
baserevid=baserevid, **kwargs)
self.lastrevid = updates['entity']['lastrevid']
@@ -2781,9 +2798,6 @@
value should be the string to set it to.
You can set it to '' to remove the label.
"""
- labels = self.__normalizeLanguages(labels)
- for key in labels:
- labels[key] = {'language': key, 'value': labels[key]}
data = {'labels': labels}
self.editEntity(data, **kwargs)
@@ -2796,9 +2810,6 @@
value should be the string to set it to.
You can set it to '' to remove the description.
"""
- descriptions = self.__normalizeLanguages(descriptions)
- for key in descriptions:
- descriptions[key] = {'language': key, 'value': descriptions[key]}
data = {'descriptions': descriptions}
self.editEntity(data, **kwargs)
@@ -2810,9 +2821,6 @@
as a language or a site object. The
value should be a list of strings.
"""
- aliases = self.__normalizeLanguages(aliases)
- for (key, strings) in list(aliases.items()):
- aliases[key] = [{'language': key, 'value': i} for i in strings]
data = {'aliases': aliases}
self.editEntity(data, **kwargs)
--
To view, visit https://gerrit.wikimedia.org/r/135139
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iba1fdce1cc199cda0b7f83febdf48ce6a11100e0
Gerrit-PatchSet: 5
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisamoa(a)openmailbox.org>
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: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: jenkins-bot <>