mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Verify PO file format with msginit.
This commit is contained in:
parent
0299008e55
commit
5ac5f23f2b
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user