jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/592487 )
Change subject: [tests] Print the exception tested with assertNoSite
......................................................................
[tests] Print the exception tested with assertNoSite
assertNoSite expects several exception when trying to create a
MWSite from url. But is is not clear, why creating the MWSite
fails. This can be happen if a urls doesn't exist any longer.
Therefore print the exception with this tests.
Change-Id: I80fcdfb68a15f75fe0650af83814c0e52e335e32
---
M tests/site_detect_tests.py
1 file changed, 6 insertions(+), 2 deletions(-)
Approvals:
Zhuyifei1999: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_detect_tests.py b/tests/site_detect_tests.py
index a5f6230..34ffaf5 100644
--- a/tests/site_detect_tests.py
+++ b/tests/site_detect_tests.py
@@ -15,6 +15,7 @@
from pywikibot.site_detect import MWSite
from pywikibot.tools import PY2
+from tests import unittest_print
from tests.aspects import unittest, TestCase, PatchingTestCase
from tests.utils import DrySite
@@ -51,8 +52,11 @@
@type url: str
@raises AssertionError: Site under url is MediaWiki powered
"""
- self.assertRaises((AttributeError, ConnectionError, RuntimeError,
- ServerError, Timeout), MWSite, url)
+ with self.assertRaises((AttributeError, ConnectionError, RuntimeError,
+ ServerError, Timeout)) as e:
+ MWSite(url)
+ unittest_print('\nassertNoSite expected exception:\n{e!r}'
+ .format(e=e.exception))
class StandardVersionSiteTestCase(SiteDetectionTestCase):
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/592487
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I80fcdfb68a15f75fe0650af83814c0e52e335e32
Gerrit-Change-Number: 592487
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Dvorapa <[email protected]>
Gerrit-Reviewer: Zhuyifei1999 <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits