jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1338964?usp=email )
Change subject: tests: Replace assertRaises with assertRaisesRegex
......................................................................
tests: Replace assertRaises with assertRaisesRegex
Check expected OSError and Timeout messages in editor and
uploadbot tests.
Bug: T154281
Change-Id: I93b64563100a1e6cef465c421047de9daf85eac1
---
M tests/editor_tests.py
M tests/uploadbot_tests.py
2 files changed, 4 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/editor_tests.py b/tests/editor_tests.py
index dafa755..aed70e1 100755
--- a/tests/editor_tests.py
+++ b/tests/editor_tests.py
@@ -65,7 +65,8 @@
return handle, filename
def run(*args, **kwargs):
- with self.assertRaises(OSError):
+ with self.assertRaisesRegex(
+ OSError, r'\[Errno 9\] Bad file descriptor'):
os.fstat(handle)
with patch.object(editor.tempfile, 'mkstemp', side_effect=mkstemp):
diff --git a/tests/uploadbot_tests.py b/tests/uploadbot_tests.py
index 1945210..9f9e09d 100755
--- a/tests/uploadbot_tests.py
+++ b/tests/uploadbot_tests.py
@@ -120,7 +120,8 @@
return_value=(temp_fd, tempname)),
mock.patch('pywikibot.specialbots._upload.http.fetch',
return_value=response),
- self.assertRaises(requests.Timeout),
+ self.assertRaisesRegex(
+ requests.Timeout, 'Download timed out'),
):
bot.read_file_content('https://yo.wikipedia.org/mahveo.png')
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1338964?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: I93b64563100a1e6cef465c421047de9daf85eac1
Gerrit-Change-Number: 1338964
Gerrit-PatchSet: 3
Gerrit-Owner: Ayush8620 <[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]