jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/354873 )
Change subject: [IMPR] Catch KeyboardInterrupt and finally print execution time in
checkimages.py
......................................................................
[IMPR] Catch KeyboardInterrupt and finally print execution time in checkimages.py
Change-Id: I737a9f4a62a3253f5eb3aaff5237180b9fd90375
---
M scripts/checkimages.py
M tests/script_tests.py
2 files changed, 6 insertions(+), 5 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index ecdebda..d556cc0 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -1800,11 +1800,12 @@
if __name__ == "__main__":
start = time.time()
+ ret = False
try:
ret = main()
- except SystemExit:
- pass
- else:
+ except KeyboardInterrupt:
+ ret = True
+ finally:
if ret is not False:
final = time.time()
delta = int(final - start)
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 3d78c82..bc6b491 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Test that each script can be compiled and executed."""
#
-# (C) Pywikibot team, 2014-2016
+# (C) Pywikibot team, 2014-2017
#
# Distributed under the terms of the MIT license.
#
@@ -150,6 +150,7 @@
# and not backtraces starting deep in the pywikibot package.
no_args_expected_results = {
# TODO: until done here, remember to set editor = None in user_config.py
+ 'checkimages': 'Execution time: 0 seconds',
'editarticle': 'Nothing changed',
'featured': '0 pages written.',
'freebasemappingupload': 'Cannot find ',
@@ -419,7 +420,6 @@
] + failed_dep_script_list
_allowed_failures = [
- 'checkimages',
'disambredir',
# T94681
'misspelling',
--
To view, visit
https://gerrit.wikimedia.org/r/354873
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I737a9f4a62a3253f5eb3aaff5237180b9fd90375
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>