jenkins-bot has submitted this change and it was merged.
Change subject: Fix UnboundLocalError
......................................................................
Fix UnboundLocalError
In python3 there may be UnboundLocalError in case of exception during save
Change-Id: I8ae74d00b63bc20b2eed511687a4feb3bc2e58ca
---
M pywikibot/page.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index e089fc2..5f58dee 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1057,7 +1057,8 @@
else:
pywikibot.output(u"Page %s saved" % link)
# TODO: other "expected" error types to catch?
- except pywikibot.Error as err:
+ except pywikibot.Error as edit_err:
+ err = edit_err # edit_err will be deleted in the end of the scope
pywikibot.log(u"Error saving page %s (%s)\n" % (link, err),
exc_info=True)
if not callback and not async:
--
To view, visit https://gerrit.wikimedia.org/r/206356
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8ae74d00b63bc20b2eed511687a4feb3bc2e58ca
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Eranroz <eranroz89(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: nosetests does not honour PYWIKIBOT2_TEST_AUTORUN
......................................................................
nosetests does not honour PYWIKIBOT2_TEST_AUTORUN
Autorun scripts aren't added to the tested methods in
script_tests.collector, however the collector isn't always used by
nosetests.
Autorun scripts run a tests which skips them if PYWIKIBOT2_TEST_AUTORUN
is set.
Bug: T95385
Change-Id: Ibbaa684588a9b46e10a86611bfc248c9ce11ac0f
---
M tests/script_tests.py
1 file changed, 14 insertions(+), 4 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 1ba6bfb..d6b97d7 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -163,14 +163,15 @@
no_args_expected_results['replicate_wiki'] = 'error: too few arguments'
+enable_autorun_tests = (
+ os.environ.get('PYWIKIBOT2_TEST_AUTORUN', '0') == '1')
+
+
def collector(loader=unittest.loader.defaultTestLoader):
"""Load the default tests."""
# Note: Raising SkipTest during load_tests will
# cause the loader to fallback to its own
# discover() ordering of unit tests.
-
- enable_autorun_tests = (
- os.environ.get('PYWIKIBOT2_TEST_AUTORUN', '0') == '1')
if deadlock_script_list:
print('Skipping deadlock scripts:\n %s'
@@ -222,6 +223,13 @@
def __new__(cls, name, bases, dct):
"""Create the new class."""
def test_execution(script_name, args=[], expected_results=None):
+ is_autorun = '-help' not in args and script_name in auto_run_script_list
+
+ def test_skip_script(self):
+ raise unittest.SkipTest(
+ 'Skipping execution of auto-run scripts (set '
+ 'PYWIKIBOT2_TEST_AUTORUN=1 to enable) "{0}"'.format(script_name))
+
def testScript(self):
cmd = [script_name]
@@ -231,7 +239,7 @@
data_in = script_input.get(script_name)
timeout = 0
- if '-help' not in args and script_name in auto_run_script_list:
+ if is_autorun:
timeout = 5
if expected_results and script_name in expected_results:
@@ -306,6 +314,8 @@
sys.stdout.flush()
+ if not enable_autorun_tests and is_autorun:
+ return test_skip_script
return testScript
for script_name in script_list:
--
To view, visit https://gerrit.wikimedia.org/r/207112
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibbaa684588a9b46e10a86611bfc248c9ce11ac0f
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: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #2167
Status: Failed
Duration: 45 minutes and 45 seconds
Commit: 75e2578 (master)
Author: Fabian Neundorf
Message: [IMPROV] isbn: Simplify hyphenateIsbnNumber
As is_valid is called in any case before hyphenating it, it can be
called in one place before any selection happens. Also is_valid does
call getIsbn anyway so the exception at the end can't happen when it
didn't happen in is_valid.
Change-Id: I64dcea54a41ee48724881b201ee3f837002bca40
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/7a04e899a03b...75e25784…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/60363485
--
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: [IMPROV] isbn: Simplify hyphenateIsbnNumber
......................................................................
[IMPROV] isbn: Simplify hyphenateIsbnNumber
As is_valid is called in any case before hyphenating it, it can be
called in one place before any selection happens. Also is_valid does
call getIsbn anyway so the exception at the end can't happen when it
didn't happen in is_valid.
Change-Id: I64dcea54a41ee48724881b201ee3f837002bca40
---
M scripts/isbn.py
1 file changed, 6 insertions(+), 11 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/isbn.py b/scripts/isbn.py
index b9b118e..769f303 100755
--- a/scripts/isbn.py
+++ b/scripts/isbn.py
@@ -1382,14 +1382,15 @@
isbn = match.group('code')
isbn = isbn.upper()
try:
+ is_valid(isbn)
+ except InvalidIsbnException:
+ return isbn
+
+ try:
stdnum.isbn
except NameError:
pass
else:
- try:
- is_valid(isbn)
- except InvalidIsbnException:
- return isbn
i = stdnum.isbn.format(isbn)
return i
@@ -1399,18 +1400,12 @@
pass
else:
try:
- is_valid(isbn)
i = isbn_hyphenate.hyphenate(isbn)
- except (InvalidIsbnException, isbn_hyphenate.IsbnMalformedError,
+ except (isbn_hyphenate.IsbnMalformedError,
isbn_hyphenate.IsbnUnableToHyphenateError):
return isbn
return i
- try:
- is_valid(isbn)
- except InvalidIsbnException:
- # don't change
- return isbn
i = getIsbn(isbn)
i.format()
return i.code
--
To view, visit https://gerrit.wikimedia.org/r/207058
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I64dcea54a41ee48724881b201ee3f837002bca40
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 <>