Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
80e5a610
Commit
80e5a610
authored
Aug 10, 2016
by
Andy Armstrong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add --settings parameter for i18n_dummy task
parent
a3f8cafb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
4 deletions
+43
-4
pavelib/i18n.py
+7
-2
pavelib/paver_tests/test_i18n.py
+36
-2
No files found.
pavelib/i18n.py
View file @
80e5a610
...
...
@@ -75,19 +75,24 @@ def i18n_generate_strict():
@task
@needs
(
"pavelib.i18n.i18n_extract"
)
@cmdopts
([
(
"settings="
,
"s"
,
"The settings to use (defaults to devstack)"
),
])
@timed
def
i18n_dummy
():
def
i18n_dummy
(
options
):
"""
Simulate international translation by generating dummy strings
corresponding to source strings.
"""
settings
=
options
.
get
(
'settings'
,
DEFAULT_SETTINGS
)
sh
(
"i18n_tool dummy"
)
# Need to then compile the new dummy strings
sh
(
"i18n_tool generate"
)
# Generate static i18n JS files.
for
system
in
[
'lms'
,
'cms'
]:
sh
(
django_cmd
(
system
,
DEFAULT_SETTINGS
,
'compilejsi18n'
))
sh
(
django_cmd
(
system
,
settings
,
'compilejsi18n'
))
@task
...
...
pavelib/paver_tests/test_i18n.py
View file @
80e5a610
...
...
@@ -2,15 +2,16 @@
Tests for pavelib/i18n.py.
"""
import
os
import
textwrap
import
unittest
from
mock
import
mock_open
,
patch
from
paver.easy
import
task
from
paver.easy
import
task
,
call_task
import
pavelib.i18n
from
pavelib.paver_tests.utils
import
PaverTestCase
from
pavelib.paver_tests.utils
import
PaverTestCase
TX_CONFIG_SIMPLE
=
"""
\
[main]
...
...
@@ -132,3 +133,36 @@ class ReleasePushPullTest(PaverTestCase):
mock_sh
.
assert_called_once_with
(
'i18n_tool transifex pull edx-platform.release-zebrawood edx-platform.release-zebrawood-js'
)
class
TestI18nDummy
(
PaverTestCase
):
"""
Test the Paver i18n_dummy task.
"""
def
setUp
(
self
):
super
(
TestI18nDummy
,
self
)
.
setUp
()
# Mock the paver @needs decorator for i18n_extract
self
.
_mock_paver_needs
=
patch
.
object
(
pavelib
.
i18n
.
i18n_extract
,
'needs'
)
.
start
()
self
.
_mock_paver_needs
.
return_value
=
0
# Cleanup mocks
self
.
addCleanup
(
self
.
_mock_paver_needs
.
stop
)
def
test_i18n_dummy
(
self
):
"""
Test the "i18n_dummy" task.
"""
self
.
reset_task_messages
()
os
.
environ
[
'NO_PREREQ_INSTALL'
]
=
"true"
call_task
(
'pavelib.i18n.i18n_dummy'
,
options
=
{
"settings"
:
'test'
})
self
.
assertEquals
(
self
.
task_messages
,
[
u'i18n_tool extract'
,
u'i18n_tool dummy'
,
u'i18n_tool generate'
,
u'python manage.py lms --settings=test compilejsi18n'
,
u'python manage.py cms --settings=test compilejsi18n'
,
]
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment