jenkins-bot has submitted this change and it was merged.
Change subject: Check that submodule i18n exists ......................................................................
Check that submodule i18n exists
Change-Id: I30caec76c68c611c2adf44142cb44872e2215194 --- M tests/bot_tests.py M tests/disambredir_tests.py M tests/i18n_tests.py M tests/isbn_tests.py M tests/l10n_tests.py M tests/replacebot_tests.py 6 files changed, 29 insertions(+), 7 deletions(-)
Approvals: John Vandenberg: Looks good to me, but someone else must approve XZise: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/bot_tests.py b/tests/bot_tests.py index 4764e79..788893b 100644 --- a/tests/bot_tests.py +++ b/tests/bot_tests.py @@ -14,11 +14,26 @@ import pywikibot import pywikibot.bot
+from pywikibot import i18n + from tests.aspects import ( unittest, DefaultSiteTestCase, SiteAttributeTestCase, TestCase, )
+class TWNBotTestCase(TestCase): + + """Verify that i18n is available.""" + + @classmethod + def setUpClass(cls): + """Verify that the translations are available.""" + if not i18n.messages_available(): + raise unittest.SkipTest("i18n messages package '%s' not available." + % i18n._messages_package_name) + super(TWNBotTestCase, cls).setUpClass() + + class FakeSaveBotTestCase(TestCase):
""" diff --git a/tests/disambredir_tests.py b/tests/disambredir_tests.py index b8487ec..c12dcd3 100644 --- a/tests/disambredir_tests.py +++ b/tests/disambredir_tests.py @@ -19,11 +19,11 @@ from scripts import disambredir
from tests.aspects import unittest -from tests.bot_tests import FakeSaveBotTestCase +from tests.bot_tests import FakeSaveBotTestCase, TWNBotTestCase from tests.utils import fixed_generator
-class TestDisambigurationRedirectBot(FakeSaveBotTestCase): +class TestDisambigurationRedirectBot(FakeSaveBotTestCase, TWNBotTestCase):
""" Test cases for DisambigurationRedirectBot. diff --git a/tests/i18n_tests.py b/tests/i18n_tests.py index 69ac9f1..7d4ed2e 100644 --- a/tests/i18n_tests.py +++ b/tests/i18n_tests.py @@ -364,12 +364,12 @@ @classmethod def setUpClass(cls): """Verify that a translation does not yet exist.""" + super(InputTestCase, cls).setUpClass() + if cls.code in i18n.twget_keys('pywikibot-enter-category-name'): raise unittest.SkipTest( '%s has a translation for %s' % (cls.code, 'pywikibot-enter-category-name')) - - super(InputTestCase, cls).setUpClass()
def test_pagegen_i18n_input(self): """Test i18n.input via .""" diff --git a/tests/isbn_tests.py b/tests/isbn_tests.py index bed1615..5ae1857 100644 --- a/tests/isbn_tests.py +++ b/tests/isbn_tests.py @@ -19,10 +19,12 @@ getIsbn, hyphenateIsbnNumbers, convertIsbn10toIsbn13, main ) + from tests.aspects import ( unittest, TestCase, DefaultDrySiteTestCase, WikibaseTestCase, ScriptMainTestCase, ) +from tests.bot_tests import TWNBotTestCase
class TestCosmeticChangesISBN(DefaultDrySiteTestCase): @@ -168,7 +170,7 @@ TestIsbnBot.newtext = newtext
-class TestIsbnWikibaseBot(ScriptMainTestCase, WikibaseTestCase): +class TestIsbnWikibaseBot(ScriptMainTestCase, WikibaseTestCase, TWNBotTestCase):
"""Test isbnbot on Wikibase site with non-write patching."""
diff --git a/tests/l10n_tests.py b/tests/l10n_tests.py index 294914a..1e81b21 100644 --- a/tests/l10n_tests.py +++ b/tests/l10n_tests.py @@ -56,6 +56,10 @@ return test_template
# create test methods for package messages processed by unittest + if not i18n.messages_available(): + raise unittest.SkipTest("i18n messages package '%s' not available." + % i18n._messages_package_name) + site = pywikibot.Site(dct['code'], dct['family']) codes = site.family.languages_by_size del site diff --git a/tests/replacebot_tests.py b/tests/replacebot_tests.py index 03aee98..04d8c30 100644 --- a/tests/replacebot_tests.py +++ b/tests/replacebot_tests.py @@ -18,14 +18,15 @@ from scripts import replace
from tests import _data_dir -from tests.aspects import unittest, TestCase +from tests.aspects import unittest +from tests.bot_tests import TWNBotTestCase
# Load only the custom fixes fixes.fixes.clear() fixes._load_file(os.path.join(_data_dir, 'fixes.py'))
-class TestReplacementsMain(TestCase): +class TestReplacementsMain(TWNBotTestCase):
"""Test various calls of main()."""
pywikibot-commits@lists.wikimedia.org