예제 #1
0
    def testlang_setup(self, request):
        self.tmp_dir = None
        self.setup_lang()

        self.domain = 'ipa'

        self.pot_basename = '%s.pot' % self.domain
        self.po_basename = '%s.po' % self.lang
        self.mo_basename = '%s.mo' % self.domain

        self.tmp_dir = tempfile.mkdtemp()

        self.locale_dir = os.path.join(self.tmp_dir, 'test_locale')
        self.msg_dir = os.path.join(self.locale_dir, self.lang, 'LC_MESSAGES')

        if not os.path.exists(self.msg_dir):
            os.makedirs(self.msg_dir)

        self.pot_file = os.path.join(
            os.path.dirname(__file__), 'data', self.pot_basename)
        self.mo_file = os.path.join(self.msg_dir, self.mo_basename)
        self.po_file = os.path.join(self.tmp_dir, self.po_basename)

        result = create_po(self.pot_file, self.po_file, self.mo_file)
        if result:
            pytest.skip(
                'Unable to create po file "%s" & mo file "%s" from pot '
                'file "%s"' % (self.po_file, self.mo_file, self.pot_file)
            )

        if not os.path.isfile(self.po_file):
            pytest.skip(
                'Test po file unavailable: {}'.format(self.po_file))

        if not os.path.isfile(self.mo_file):
            pytest.skip(
                'Test mo file unavailable: {}'.format(self.mo_file))

        self.po_file_iterate = po_file_iterate

        def fin():
            self.teardown_lang()

            if self.tmp_dir is not None:
                shutil.rmtree(self.tmp_dir)
        request.addfinalizer(fin)
예제 #2
0
    def setup(self):
        self.tmp_dir = None
        self.saved_lang = None

        self.lang = 'xh_ZA'
        self.domain = 'ipa'

        self.ipa_i18n_dir = os.path.join(os.path.dirname(__file__),
                                         '../../install/po')

        self.pot_basename = '%s.pot' % self.domain
        self.po_basename = '%s.po' % self.lang
        self.mo_basename = '%s.mo' % self.domain

        self.tmp_dir = tempfile.mkdtemp()
        self.saved_lang = os.environ['LANG']

        self.locale_dir = os.path.join(self.tmp_dir, 'test_locale')
        self.msg_dir = os.path.join(self.locale_dir, self.lang, 'LC_MESSAGES')

        if not os.path.exists(self.msg_dir):
            os.makedirs(self.msg_dir)

        self.pot_file = os.path.join(self.ipa_i18n_dir, self.pot_basename)
        self.mo_file = os.path.join(self.msg_dir, self.mo_basename)
        self.po_file = os.path.join(self.tmp_dir, self.po_basename)

        result = create_po(self.pot_file, self.po_file, self.mo_file)
        if result:
            raise nose.SkipTest(
                'Unable to create po file "%s" & mo file "%s" from pot file "%s"'
                % (self.po_file, self.mo_file, self.pot_file))

        if not file_exists(self.po_file):
            raise nose.SkipTest(
                'Test po file unavailable, run "make test" in install/po')

        if not file_exists(self.mo_file):
            raise nose.SkipTest(
                'Test mo file unavailable, run "make test" in install/po')

        self.po_file_iterate = po_file_iterate
예제 #3
0
    def setup(self):
        self.tmp_dir = None
        self.setup_lang()

        self.domain = 'ipa'

        self.pot_basename = '%s.pot' % self.domain
        self.po_basename = '%s.po' % self.lang
        self.mo_basename = '%s.mo' % self.domain

        self.tmp_dir = tempfile.mkdtemp()

        self.locale_dir = os.path.join(self.tmp_dir, 'test_locale')
        self.msg_dir = os.path.join(self.locale_dir, self.lang, 'LC_MESSAGES')

        if not os.path.exists(self.msg_dir):
            os.makedirs(self.msg_dir)

        self.pot_file = os.path.join(
            os.path.dirname(__file__), 'data', self.pot_basename)
        self.mo_file = os.path.join(self.msg_dir, self.mo_basename)
        self.po_file = os.path.join(self.tmp_dir, self.po_basename)

        result = create_po(self.pot_file, self.po_file, self.mo_file)
        if result:
            raise unittest.SkipTest(
                'Unable to create po file "%s" & mo file "%s" from pot '
                'file "%s"' % (self.po_file, self.mo_file, self.pot_file)
            )

        if not os.path.isfile(self.po_file):
            raise unittest.SkipTest(
                'Test po file unavailable: {}'.format(self.po_file))

        if not os.path.isfile(self.mo_file):
            raise unittest.SkipTest(
                'Test mo file unavailable: {}'.format(self.mo_file))

        self.po_file_iterate = po_file_iterate
예제 #4
0
    def setup(self):
        self.tmp_dir = None
        self.setup_lang()

        self.domain = 'ipa'

        self.pot_basename = '%s.pot' % self.domain
        self.po_basename = '%s.po' % self.lang
        self.mo_basename = '%s.mo' % self.domain

        self.tmp_dir = tempfile.mkdtemp()

        self.locale_dir = os.path.join(self.tmp_dir, 'test_locale')
        self.msg_dir = os.path.join(self.locale_dir, self.lang, 'LC_MESSAGES')

        if not os.path.exists(self.msg_dir):
            os.makedirs(self.msg_dir)

        self.pot_file = os.path.join(
            os.path.dirname(__file__), 'data', self.pot_basename)
        self.mo_file = os.path.join(self.msg_dir, self.mo_basename)
        self.po_file = os.path.join(self.tmp_dir, self.po_basename)

        result = create_po(self.pot_file, self.po_file, self.mo_file)
        if result:
            raise unittest.SkipTest(
                'Unable to create po file "%s" & mo file "%s" from pot '
                'file "%s"' % (self.po_file, self.mo_file, self.pot_file)
            )

        if not os.path.isfile(self.po_file):
            raise unittest.SkipTest(
                'Test po file unavailable: {}'.format(self.po_file))

        if not os.path.isfile(self.mo_file):
            raise unittest.SkipTest(
                'Test mo file unavailable: {}'.format(self.mo_file))

        self.po_file_iterate = po_file_iterate
예제 #5
0
    def setup(self):
        self.tmp_dir = None
        self.saved_lang  = None

        self.lang = 'xh_ZA'
        self.domain = 'ipa'

        self.ipa_i18n_dir = os.path.join(os.path.dirname(__file__), '../../install/po')

        self.pot_basename = '%s.pot' % self.domain
        self.po_basename = '%s.po' % self.lang
        self.mo_basename = '%s.mo' % self.domain

        self.tmp_dir = tempfile.mkdtemp()
        self.saved_lang  = os.environ['LANG']

        self.locale_dir = os.path.join(self.tmp_dir, 'test_locale')
        self.msg_dir = os.path.join(self.locale_dir, self.lang, 'LC_MESSAGES')

        if not os.path.exists(self.msg_dir):
            os.makedirs(self.msg_dir)

        self.pot_file = os.path.join(self.ipa_i18n_dir, self.pot_basename)
        self.mo_file = os.path.join(self.msg_dir, self.mo_basename)
        self.po_file = os.path.join(self.tmp_dir, self.po_basename)

        result = create_po(self.pot_file, self.po_file, self.mo_file)
        if result:
            raise nose.SkipTest('Unable to create po file "%s" & mo file "%s" from pot file "%s"' %
                                (self.po_file, self.mo_file, self.pot_file))

        if not file_exists(self.po_file):
            raise nose.SkipTest('Test po file unavailable, run "make test" in install/po')

        if not file_exists(self.mo_file):
            raise nose.SkipTest('Test mo file unavailable, run "make test" in install/po')

        self.po_file_iterate = po_file_iterate
예제 #6
0
    def setup(self):
        self.tmp_dir = None
        self.setup_lang()

        self.domain = "ipa"

        self.pot_basename = "%s.pot" % self.domain
        self.po_basename = "%s.po" % self.lang
        self.mo_basename = "%s.mo" % self.domain

        self.tmp_dir = tempfile.mkdtemp()

        self.locale_dir = os.path.join(self.tmp_dir, "test_locale")
        self.msg_dir = os.path.join(self.locale_dir, self.lang, "LC_MESSAGES")

        if not os.path.exists(self.msg_dir):
            os.makedirs(self.msg_dir)

        self.pot_file = os.path.join(os.path.dirname(__file__), "data", self.pot_basename)
        self.mo_file = os.path.join(self.msg_dir, self.mo_basename)
        self.po_file = os.path.join(self.tmp_dir, self.po_basename)

        result = create_po(self.pot_file, self.po_file, self.mo_file)
        if result:
            raise nose.SkipTest(
                'Unable to create po file "%s" & mo file "%s" from pot file "%s"'
                % (self.po_file, self.mo_file, self.pot_file)
            )

        if not file_exists(self.po_file):
            raise nose.SkipTest("Test po file unavailable: {}".format(self.po_file))

        if not file_exists(self.mo_file):
            raise nose.SkipTest("Test mo file unavailable: {}".format(self.mo_file))

        self.po_file_iterate = po_file_iterate