jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
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(-)

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 change 1183215. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I26f555eb074a0452a16fc0952c0e071792b3f0d8
Gerrit-Change-Number: 1183215
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot