Verify PO file format with msginit.

This commit is contained in:
Robert Lehmann 2010-06-09 06:46:30 +02:00
parent 0299008e55
commit 5ac5f23f2b

View File

@ -9,6 +9,9 @@
:license: BSD, see LICENSE for details.
"""
import os
from subprocess import Popen, PIPE
from util import *
@ -22,3 +25,22 @@ def test_gettext(app):
assert (app.outdir / 'contents.pot').isfile()
# group into sections
assert (app.outdir / 'subdir.pot').isfile()
cwd = os.getcwd()
os.chdir(app.outdir)
try:
try:
p = Popen(['msginit', '--no-translator', '-i', 'contents.pot'],
stdout=PIPE, stderr=PIPE)
except OSError:
return # most likely msginit was not found
else:
stdout, stderr = p.communicate()
if p.returncode != 0:
print stdout
print stderr
del app.cleanup_trees[:]
assert False, 'msginit exited with return code %s' % p.returncode
assert (app.outdir / 'en_US.po').isfile(), 'msginit failed'
finally:
os.chdir(cwd)