http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11699
Revision: 11699 Author: legoktm Date: 2013-06-28 08:24:28 +0000 (Fri, 28 Jun 2013) Log Message: ----------- Fix twtranslate tests by temporarily moving tests/i18n/test.py into scripts/i18n/ when running
Modified Paths: -------------- branches/rewrite/tests/i18n_tests.py
Modified: branches/rewrite/tests/i18n_tests.py =================================================================== --- branches/rewrite/tests/i18n_tests.py 2013-06-28 07:54:39 UTC (rev 11698) +++ branches/rewrite/tests/i18n_tests.py 2013-06-28 08:24:28 UTC (rev 11699) @@ -7,8 +7,11 @@ __version__ = '$Id$'
import unittest +import os from pywikibot import i18n +import shutil
+ class TestTranslate(unittest.TestCase): def setUp(self): self.msg_localized = {'en': u'test-localized EN', @@ -17,7 +20,7 @@ self.msg_semi_localized = {'en': u'test-semi-localized EN', 'nl': u'test-semi-localized NL'} self.msg_non_localized = {'en': u'test-non-localized EN'} - self.msg_no_english = {'ja': u'test-no-english JA'} + self.msg_no_english = {'ja': u'test-no-english JA'}
def testLocalized(self): self.assertEqual(i18n.translate('en', self.msg_localized), @@ -55,6 +58,13 @@
class TestTWTranslate(unittest.TestCase): + def setUp(self): + self.path = os.path.realpath(__file__)[:-13] + shutil.copyfile(self.path + 'i18n/test.py', self.path + '../scripts/i18n/test.py') + + def tearDown(self): + os.remove(self.path + '../scripts/i18n/test.py') + def testLocalized(self): self.assertEqual(i18n.twtranslate('en', 'test-localized'), u'test-localized EN')
pywikipedia-svn@lists.wikimedia.org