jenkins-bot has submitted this change and it was merged.
Change subject: Revert "tests should use tests/i18n" ......................................................................
Revert "tests should use tests/i18n"
https://bugzilla.wikimedia.org/show_bug.cgi?id=66881
This reverts commit 5eee5725862e5bab84fd66c056d58b26bd7087ea.
Change-Id: Ic0bc53600bea1c5a7fd4b7ac4ef73c75080318e5 --- M pywikibot/config2.py M pywikibot/i18n.py M tests/i18n_tests.py 3 files changed, 5 insertions(+), 10 deletions(-)
Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py index 111c633..87883fe 100644 --- a/pywikibot/config2.py +++ b/pywikibot/config2.py @@ -624,9 +624,6 @@ # if the user has already installed the library. use_mwparserfromhell = True
-# location of i18n messages for scripts -i18n_dir = 'scripts/i18n' - # End of configuration section # ============================
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py index 4ef33c0..c204121 100644 --- a/pywikibot/i18n.py +++ b/pywikibot/i18n.py @@ -12,7 +12,6 @@ #
import re -from os import sep as os_dir_sep import locale from pywikibot import Error from .plural import plural_rules @@ -349,8 +348,7 @@ import table. """ package = twtitle.split("-")[0] - import_dir = config.i18n_dir[:].replace(os_dir_sep, '.') - transdict = getattr(__import__(import_dir, fromlist=[package]), package).msg + transdict = getattr(__import__("scripts.i18n", fromlist=[package]), package).msg
code_needed = False # If a site is given instead of a code, use its language diff --git a/tests/i18n_tests.py b/tests/i18n_tests.py index ba47238..f6e2c6e 100644 --- a/tests/i18n_tests.py +++ b/tests/i18n_tests.py @@ -8,7 +8,6 @@
import os from pywikibot import i18n -from pywikibot import config2 as config import shutil
from tests.utils import unittest @@ -74,11 +73,12 @@
class TestTWN(unittest.TestCase): def setUp(self): - self.orig_i18n_dir = config.i18n_dir - config.i18n_dir = 'tests/i18n' + self.path = os.path.split(os.path.realpath(__file__))[0] + shutil.copyfile(os.path.join(self.path, 'i18n', 'test.py'), + os.path.join(self.path, '..', 'scripts', 'i18n', 'test.py'))
def tearDown(self): - config.i18n_dir = self.orig_i18n_dir + os.remove(os.path.join(self.path, '..', 'scripts', 'i18n', 'test.py'))
class TestTWTranslate(TestTWN):