diff options
| author | Robert Lehmann <mail@robertlehmann.de> | 2010-06-29 23:30:22 +0200 |
|---|---|---|
| committer | Robert Lehmann <mail@robertlehmann.de> | 2010-06-29 23:30:22 +0200 |
| commit | 1433b5cb11a00a72e36c47ba3fafb5e46c6b0df8 (patch) | |
| tree | a8edf9e0cb4db0b857eb6938a1d604127e01706d /tests/test_build_gettext.py | |
| parent | 4b8249e6b11fb38ad2d49e06b787b8eaa9f6b470 (diff) | |
| download | sphinx-git-1433b5cb11a00a72e36c47ba3fafb5e46c6b0df8.tar.gz | |
Test translation patching in vitro.
Diffstat (limited to 'tests/test_build_gettext.py')
| -rw-r--r-- | tests/test_build_gettext.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_build_gettext.py b/tests/test_build_gettext.py index 09dc0adb6..ede092894 100644 --- a/tests/test_build_gettext.py +++ b/tests/test_build_gettext.py @@ -70,3 +70,30 @@ def test_gettext(app): @with_app(buildername='gettext') def test_all(app): app.builder.build_all() + +@with_app(buildername='text', + confoverrides={'language': 'xx', 'locale_dirs': ['.']}) +def test_patch(app): + app.builder.build(['bom']) + res = (app.outdir / 'bom.txt').text('utf-8') + assert res == u"Datei mit UTF-8 BOM\n\nThis file has umlauts: äöü.\n" + +def setup_patch(): + (test_root / 'xx' / 'LC_MESSAGES').makedirs() + try: + p = Popen(['msgfmt', test_root / 'bom.po', '-o', + test_root / 'xx' / 'LC_MESSAGES' / 'bom.mo'], + stdout=PIPE, stderr=PIPE) + except OSError: + return # most likely msgfmt was not found + else: + stdout, stderr = p.communicate() + if p.returncode != 0: + print stdout + print stderr + assert False, 'msgfmt exited with return code %s' % p.returncode + assert (test_root / 'xx' / 'LC_MESSAGES' / 'bom.mo').isfile(), 'msgfmt failed' +def teardown_patch(): + (test_root / 'xx').rmtree() +test_patch.setup = setup_patch +test_patch.teardown = teardown_patch |
