Commit b22c1c0a authored by Michal Čihař's avatar Michal Čihař

Simplify code

Use skipIf for skipping non supported file formats.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent b8f7f615
......@@ -22,7 +22,7 @@ File format specific behavior.
'''
import tempfile
from StringIO import StringIO
from unittest import TestCase
from unittest import TestCase, SkipTest
from weblate.trans.formats import (
AutoFormat, PoFormat, AndroidFormat, PropertiesFormat,
JSONFormat, RESXFormat, PhpFormat, XliffFormat,
......@@ -31,6 +31,7 @@ from weblate.trans.formats import (
from weblate.trans.tests.utils import get_test_file
from translate.storage.po import pofile
TEST_PO = get_test_file('cs.po')
TEST_JSON = get_test_file('cs.json')
TEST_PHP = get_test_file('cs.php')
......@@ -201,19 +202,22 @@ class XliffFormatTest(AutoFormatTest):
EXPECTED_PATH = 'loc/cs_CZ/default.xliff'
if 'resx' in FILE_FORMATS:
class RESXFormatTest(AutoFormatTest):
FORMAT = RESXFormat
FILE = TEST_RESX
MIME = 'text/microsoft-resx'
EXT = 'resx'
COUNT = 4
MASK = 'resx/*.resx'
EXPECTED_PATH = 'resx/cs_CZ.resx'
FIND = u'Hello'
FIND_MATCH = u''
MATCH = '<root></root>'
class RESXFormatTest(AutoFormatTest):
FORMAT = RESXFormat
FILE = TEST_RESX
MIME = 'text/microsoft-resx'
EXT = 'resx'
COUNT = 4
MASK = 'resx/*.resx'
EXPECTED_PATH = 'resx/cs_CZ.resx'
FIND = u'Hello'
FIND_MATCH = u''
MATCH = '<root></root>'
def setUp(self):
super(RESXFormatTest, self).setUp()
if 'resx' not in FILE_FORMATS:
raise SkipTest('resx not supported!')
class OutputTest(TestCase):
def test_json_default_output(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment