Xqt has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/511382 )
Change subject: [tests] Use subTest to get all tests be processed ......................................................................
[tests] Use subTest to get all tests be processed
Normally a test method is exited if on assert failes and the other tests aren't done. Use subTest to check all assertions in the given method. This test is related to T223865 detecting the failure.
Note: subTest work on Python 3 only and is igrnored on Python 2.
Change-Id: I7273964e3449cac00d6562086c0f53ff57843e3d --- M tests/page_tests.py 1 file changed, 8 insertions(+), 4 deletions(-)
Approvals: jenkins-bot: Verified Dvorapa: Looks good to me, approved
diff --git a/tests/page_tests.py b/tests/page_tests.py index f538463..55ce2fe 100644 --- a/tests/page_tests.py +++ b/tests/page_tests.py @@ -1185,10 +1185,14 @@ """Test create_short_link function.""" site = self.get_site() p1 = pywikibot.Page(site, 'User:Framawiki/pwb_tests/shortlink') - self.assertEqual(p1.create_short_link(), 'w.wiki/3Cy') - self.assertEqual(p1.create_short_link(with_protocol=True), - 'https://w.wiki/3Cy') - self.assertEqual(p1.create_short_link(permalink=True), 'w.wiki/3Cz') + with self.subTest(parameters='defaulted'): + self.assertEqual(p1.create_short_link(), 'w.wiki/3Cy') + with self.subTest(with_protocol=True): + self.assertEqual(p1.create_short_link(with_protocol=True), + 'https://w.wiki/3Cy') + with self.subTest(permalink=True): + self.assertEqual(p1.create_short_link(permalink=True), + 'w.wiki/3Cz')
if __name__ == '__main__': # pragma: no cover
pywikibot-commits@lists.wikimedia.org