Skip to content

Commit

Permalink
Merge pull request #3715 from freedomofpress/ForRealFixTests
Browse files Browse the repository at this point in the history
Use absolute pathing in i18n testing
  • Loading branch information
redshiftzero authored Aug 16, 2018
2 parents 52a8ebe + 364d5b3 commit 78743d6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions securedrop/tests/test_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import journalist_app as journalist_app_module
import pytest
import source_app
from utils.env import TESTS_DIR

from sh import sed, pybabel

Expand Down Expand Up @@ -174,14 +175,14 @@ def test_i18n(journalist_app, config):
del journalist_app

sources = [
'tests/i18n/code.py',
'tests/i18n/template.html',
os.path.join(TESTS_DIR, 'i18n/code.py'),
os.path.join(TESTS_DIR, 'i18n/template.html'),
]

i18n_tool.I18NTool().main([
'--verbose',
'translate-messages',
'--mapping', 'tests/i18n/babel.cfg',
'--mapping', os.path.join(TESTS_DIR, 'i18n/babel.cfg'),
'--translations-dir', config.TEMP_DIR,
'--sources', ",".join(sources),
'--extract-update',
Expand Down
5 changes: 3 additions & 2 deletions securedrop/tests/test_template_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import journalist_app
import source_app
import template_filters
from utils.env import TESTS_DIR

from sh import pybabel

Expand Down Expand Up @@ -98,9 +99,9 @@ def do_test(config, create_app):
i18n_tool.I18NTool().main([
'--verbose',
'translate-messages',
'--mapping', 'tests/i18n/babel.cfg',
'--mapping', os.path.join(TESTS_DIR, 'i18n/babel.cfg'),
'--translations-dir', config.TEMP_DIR,
'--sources', 'tests/i18n/code.py',
'--sources', os.path.join(TESTS_DIR, 'i18n/code.py'),
'--extract-update',
'--compile',
])
Expand Down
3 changes: 2 additions & 1 deletion securedrop/tests/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

from db import db

FILES_DIR = abspath(join(dirname(realpath(__file__)), '..', 'files'))
TESTS_DIR = abspath(join(dirname(realpath(__file__)), '..'))
FILES_DIR = join(TESTS_DIR, 'files')

# The PID file for the redis worker is hard-coded below. Ideally this
# constant would be provided by a test harness. It has been intentionally
Expand Down

0 comments on commit 78743d6

Please sign in to comment.