jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1183215?usp=email )
Change subject: Request: use unittest_print to show Exception in
Rweusests._http_request
......................................................................
Request: use unittest_print to show Exception in Rweusests._http_request
Bug: T403292
Change-Id: I26f555eb074a0452a16fc0952c0e071792b3f0d8
---
M pywikibot/data/api/_requests.py
1 file changed, 11 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api/_requests.py b/pywikibot/data/api/_requests.py
index 0186acc..07fa07f 100644
--- a/pywikibot/data/api/_requests.py
+++ b/pywikibot/data/api/_requests.py
@@ -49,6 +49,8 @@
if TEST_RUNNING:
import unittest
+ # lazy load unittest_print to prevent circular imports
+
# Actions that imply database updates on the server, used for various
# things like throttling or skipping actions when we're in simulation
# mode
@@ -716,8 +718,15 @@
# TODO: what other exceptions can occur here?
except Exception:
# for any other error on the http request, wait and retry
- pywikibot.error(traceback.format_exc())
- pywikibot.log(f'{uri}, {paramstring}')
+ tb = traceback.format_exc()
+ msg = f'{uri}, {paramstring}'
+ if TEST_RUNNING:
+ from tests import unittest_print
+ unittest_print(tb)
+ unittest_print(msg)
+ else:
+ pywikibot.error(tb)
+ pywikibot.log(msg)
else:
return response, use_get
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1183215?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I26f555eb074a0452a16fc0952c0e071792b3f0d8
Gerrit-Change-Number: 1183215
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]