jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/831185 )

Change subject: [tests] additional tests using skipping context manager
......................................................................

[tests] additional tests using skipping context manager

Change-Id: If148bb395235a16eeeff927b750eff95aae50b2a
---
M tests/generate_family_file_tests.py
M tests/tools_tests.py
2 files changed, 8 insertions(+), 8 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/generate_family_file_tests.py 
b/tests/generate_family_file_tests.py
index 58aa969..6ed0783 100755
--- a/tests/generate_family_file_tests.py
+++ b/tests/generate_family_file_tests.py
@@ -13,6 +13,7 @@
 from pywikibot import Site
 from pywikibot.scripts import generate_family_file
 from tests.aspects import DefaultSiteTestCase
+from tests.utils import skipping


 class FamilyTestGenerator(generate_family_file.FamilyFileGenerator):
@@ -94,15 +95,14 @@

                 site = Site(url=url)

-                try:  # T194138 to be solved
+                with skipping(AssertionError,
+                              msg='KNOWN BUG (T194138): url has lang "{lang}" '
+                                  'but Site {site} has lang "{site.lang}"'
+                                  .format(site=site, lang=lang)):
                     self.assertEqual(site.lang, lang,
                                      'url has lang "{lang}" '
                                      'but Site {site} has lang "{site.lang}"'
                                      .format(site=site, lang=lang))
-                except AssertionError:
-                    self.skipTest('KNOWN BUG: url has lang "{lang}" '
-                                  'but Site {site} has lang "{site.lang}"'
-                                  .format(site=site, lang=lang))


 if __name__ == '__main__':  # pragma: no cover
diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index af42ea1..11ac059 100755
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -32,6 +32,7 @@

 from tests import join_xml_data_path
 from tests.aspects import TestCase, require_modules
+from tests.utils import skipping


 class OpenArchiveTestCase(TestCase):
@@ -109,10 +110,9 @@

     def test_open_archive_7z(self):
         """Test open_archive with 7za if installed."""
-        try:
+        with skipping(OSError, msg='7za not installed'):
             subprocess.Popen(['7za'], stdout=subprocess.PIPE).stdout.close()
-        except OSError:
-            self.skipTest('7za not installed')
+
         self.assertEqual(
             self._get_content(self.base_file + '.7z'), self.original_content)
         with self.assertRaisesRegex(

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/831185
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: If148bb395235a16eeeff927b750eff95aae50b2a
Gerrit-Change-Number: 831185
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to