John Vandenberg has uploaded a new change for review.
https://gerrit.wikimedia.org/r/233667
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/replacebot_tests.py
5 files changed, 24 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/67/233667/1
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 148e953..4963cfc 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/replacebot_tests.py b/tests/replacebot_tests.py
index 03aee98..ffcd21e 100644
--- a/tests/replacebot_tests.py
+++ b/tests/replacebot_tests.py
@@ -19,13 +19,14 @@
from tests import _data_dir
from tests.aspects import unittest, TestCase
+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()."""
--
To view, visit https://gerrit.wikimedia.org/r/233667
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I30caec76c68c611c2adf44142cb44872e2215194
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits