jenkins-bot submitted this change.
[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(-)
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 change 592487. To unsubscribe, or for help writing mail filters, visit settings.