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

Change subject: [tests] Update l10n_tests.py
......................................................................

[tests] Update l10n_tests.py

- discard site tests because it does not care whether a site exists with
  the given language code. Probably the language is used by incubator
- test the package anyway; add two keys for the tests.

Bug: T298388
Change-Id: Ib80b7b5a488498e9de3c9dcfbf51a8b3ab8db3ed
---
M tests/l10n_tests.py
1 file changed, 10 insertions(+), 15 deletions(-)

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



diff --git a/tests/l10n_tests.py b/tests/l10n_tests.py
index 820f5d6..04388de 100644
--- a/tests/l10n_tests.py
+++ b/tests/l10n_tests.py
@@ -6,6 +6,7 @@
 #
 import unittest
 from contextlib import suppress
+from itertools import chain

 import pywikibot
 from pywikibot import i18n
@@ -98,26 +99,20 @@
                                     .format(i18n._messages_package_name))


-class TestSites(TestCase):
+class TestPackages(TestCase):

     """Other test L10N cases processed by unittest."""

-    family = 'wikipedia'
-    code = 'en'
+    net = False

-    def test_valid_sites(self):
-        """Test whether language key has a corresponding site."""
-        codes = self.site.family.languages_by_size
-        languages = {pywikibot.Site(code, self.family).lang for code in codes}
-        # langs used by foreign wikis
-        languages.update(('pt-br', 'zh-tw'))
-        for package in PACKAGES:
+    def test_valid_package(self):
+        """Test whether package has entries."""
+        for package in chain(['cosmetic_changes-standalone',
+                              'pywikibot-cosmetic-changes'], PACKAGES):
             keys = i18n.twget_keys(package)
-            for key in keys:
-                with self.subTest(package=package, key=key):
-                    self.assertIn(key, languages,
-                                  "json key '{}' is not a site language"
-                                  .format(key))
+            with self.subTest(package=package):
+                self.assertIsNotEmpty(keys)
+                self.assertIn('en', keys)


 if __name__ == '__main__':  # pragma: no cover

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/750706
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: Ib80b7b5a488498e9de3c9dcfbf51a8b3ab8db3ed
Gerrit-Change-Number: 750706
Gerrit-PatchSet: 1
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