jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/399187 )
Change subject: site_tests.TestImageUsage: Only look for images on the main page
......................................................................
site_tests.TestImageUsage: Only look for images on the main page
Iterating over `mysite.allpages` may take a long time and cause a timeout.
Bug: T182525
Change-Id: I9281de2f1b18ea1dfd291a98a342d1f13f0f3680
---
M tests/site_tests.py
1 file changed, 8 insertions(+), 11 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 3ef9079..df886aa 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -1058,9 +1058,9 @@
@property
def imagepage(self):
- """Find an image which is used on a page.
+ """Find an image which is used on the main page.
- If there are no images included in pages it'll skip all tests.
+ If there are no images included in main page it'll skip all tests.
Note: This is not implemented as setUpClass which would be invoked
while initialising all tests, to reduce chance of an error preventing
@@ -1070,15 +1070,12 @@
return self.__class__._image_page
mysite = self.get_site()
- for page in mysite.allpages(filterredir=False):
- try:
- imagepage = next(iter(page.imagelinks())) # 1st image of page
- except StopIteration:
- pass
- else:
- break
- else:
- raise unittest.SkipTest("No images on site {0!r}".format(mysite))
+ page = pywikibot.Page(mysite, mysite.siteinfo['mainpage'])
+ try:
+ imagepage = next(iter(page.imagelinks())) # 1st image of page
+ except StopIteration:
+ raise unittest.SkipTest(
+ 'No images on the main page of site {0!r}'.format(mysite))
pywikibot.output(u'site_tests.TestImageUsage found %s on %s'
% (imagepage, page))
--
To view, visit https://gerrit.wikimedia.org/r/399187
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9281de2f1b18ea1dfd291a98a342d1f13f0f3680
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/398882 )
Change subject: [doc] Print a more understandable error message
......................................................................
[doc] Print a more understandable error message
- currently type checking of the color_format text value may give the message
"expected str got <type 'str'>" for python 2 which is a bit confusing.
- now it gives "expected <type 'unicode'> got <type 'str'>" for python 2 and
"expected <class 'str'> got <class 'bytes'>" in python 3 which is more
accurate
Change-Id: Id3c07760c6c8d5ec611975c4d9d0c34a65466f7d
---
M pywikibot/tools/formatter.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/tools/formatter.py b/pywikibot/tools/formatter.py
index 149454b..cd8b96c 100644
--- a/pywikibot/tools/formatter.py
+++ b/pywikibot/tools/formatter.py
@@ -156,7 +156,8 @@
raise ValueError('Keyword argument(s) use valid color(s): ' +
'", "'.join(self.colors.intersection(kwargs)))
if not isinstance(format_string, UnicodeType):
- raise TypeError('expected str, got {0}'.format(type(format_string)))
+ raise TypeError('expected {0}, got {1}'
+ .format(type(''), type(format_string)))
return super(_ColorFormatter, self).vformat(format_string, args,
kwargs)
--
To view, visit https://gerrit.wikimedia.org/r/398882
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id3c07760c6c8d5ec611975c4d9d0c34a65466f7d
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/388257 )
Change subject: Explain that user must execute a second time the command
......................................................................
Explain that user must execute a second time the command
Bug: T179627
Change-Id: If8223f3be6981607e775d9f168b7ccddcaefdd53
---
M pwb.py
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
Zoranzoki21: Looks good to me, but someone else must approve
diff --git a/pwb.py b/pwb.py
index cd99f5f..7d877ed 100755
--- a/pwb.py
+++ b/pwb.py
@@ -194,6 +194,7 @@
['generate_user_files.py'])
# because we have loaded pywikibot without user-config.py loaded, we need to re-start
# the entire process. Ask the user to do so.
+ print('Now, you have to re-execute the command to start your script.')
sys.exit(1)
--
To view, visit https://gerrit.wikimedia.org/r/388257
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If8223f3be6981607e775d9f168b7ccddcaefdd53
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/398509 )
Change subject: diff_checker.py: Fix the logic of calculating error state
......................................................................
diff_checker.py: Fix the logic of calculating error state
Also fix an encoding issue in Python 3 where `universal_newlines` parameter
in `subprocess.check_output` forces the result to be in text mode, but it also
needs to know the `encoding` of the result to correctly decode utf-8 diffs,
but `check_output` in Python 2 does not have the `encoding` parameter.
Therefore we have to decode the file and normalize newlines ourselves in both
Python 2 and 3.
Change-Id: I7ab6d63c1d213087e23481679c7ef2a8665835d9
---
M scripts/maintenance/diff_checker.py
1 file changed, 4 insertions(+), 5 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/scripts/maintenance/diff_checker.py b/scripts/maintenance/diff_checker.py
index 957c247..734befd 100644
--- a/scripts/maintenance/diff_checker.py
+++ b/scripts/maintenance/diff_checker.py
@@ -51,10 +51,9 @@
"""Return the PatchSet for the latest commit."""
# regex from https://github.com/PyCQA/pylint/blob/master/pylintrc
output = check_output(
- ['git', 'diff', '-U0', '@~..@'], universal_newlines=True)
- if version_info.major == 2:
- return PatchSet.from_string(output, encoding='utf-8')
- return PatchSet.from_string(output)
+ ['git', 'diff', '-U0', '@~..@'])
+ return PatchSet.from_string(
+ output.replace(b'\r\n', b'\n'), encoding='utf-8')
def print_error(path, line_no, col_no, error):
@@ -119,7 +118,7 @@
)
error = True
if added_lines:
- error = check_tokens(path, added_lines) and error
+ error = not check_tokens(path, added_lines) or error
return not error
--
To view, visit https://gerrit.wikimedia.org/r/398509
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7ab6d63c1d213087e23481679c7ef2a8665835d9
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>