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

Add helper for getting test file names

parent 28fbad38
...@@ -25,16 +25,9 @@ Tests for dictionary manipulations. ...@@ -25,16 +25,9 @@ Tests for dictionary manipulations.
from trans.tests.views import ViewTestCase from trans.tests.views import ViewTestCase
from trans.models import Dictionary from trans.models import Dictionary
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
import os.path from trans.tests.util import get_test_file
TEST_DATA = os.path.join( TEST_TBX = get_test_file('terms.tbx')
os.path.dirname(os.path.abspath(__file__)),
'data'
)
TEST_TBX = os.path.join(
TEST_DATA,
'terms.tbx'
)
class DictionaryTest(ViewTestCase): class DictionaryTest(ViewTestCase):
......
...@@ -24,16 +24,9 @@ Tests for import and export. ...@@ -24,16 +24,9 @@ Tests for import and export.
from trans.tests.views import ViewTestCase from trans.tests.views import ViewTestCase
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
import os.path from trans.tests.util import get_test_file
TEST_DATA = os.path.join( TEST_PO = get_test_file('cs.po')
os.path.dirname(os.path.abspath(__file__)),
'data'
)
TEST_PO = os.path.join(
TEST_DATA,
'cs.po'
)
TRANSLATION_OURS = u'Nazdar světe!\n' TRANSLATION_OURS = u'Nazdar světe!\n'
TRANSLATION_PO = u'Ahoj světe!\n' TRANSLATION_PO = u'Ahoj světe!\n'
......
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2013 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import os.path
# Directory holding test data
TEST_DATA = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'data'
)
def get_test_file(name):
'''
Retuns filename of test file.
'''
return os.path.join(TEST_DATA, name)
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