mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
refactoring
This commit is contained in:
parent
2472dcec39
commit
8a1cb70354
@ -25,11 +25,13 @@ warnfile = StringIO()
|
|||||||
def setup_module():
|
def setup_module():
|
||||||
(test_root / 'xx' / 'LC_MESSAGES').makedirs()
|
(test_root / 'xx' / 'LC_MESSAGES').makedirs()
|
||||||
# Compile all required catalogs into binary format (*.mo).
|
# Compile all required catalogs into binary format (*.mo).
|
||||||
for catalog in ('bom', 'subdir', 'i18n_footnote', 'i18n_external_links',
|
for dirpath, dirs, files in os.walk(test_root):
|
||||||
'i18n_refs_inconsistency'):
|
for f in [f for f in files if f.endswith('.po')]:
|
||||||
|
po = os.path.join(dirpath, f)
|
||||||
|
mo = test_root / 'xx' / 'LC_MESSAGES' / (
|
||||||
|
os.path.relpath(po[:-3], test_root) + '.mo')
|
||||||
try:
|
try:
|
||||||
p = Popen(['msgfmt', test_root / '%s.po' % catalog, '-o',
|
p = Popen(['msgfmt', po, '-o', mo],
|
||||||
test_root / 'xx' / 'LC_MESSAGES' / '%s.mo' % catalog],
|
|
||||||
stdout=PIPE, stderr=PIPE)
|
stdout=PIPE, stderr=PIPE)
|
||||||
except OSError:
|
except OSError:
|
||||||
# The test will fail the second time it's run if we don't
|
# The test will fail the second time it's run if we don't
|
||||||
@ -44,8 +46,7 @@ def setup_module():
|
|||||||
print stdout
|
print stdout
|
||||||
print stderr
|
print stderr
|
||||||
assert False, 'msgfmt exited with return code %s' % p.returncode
|
assert False, 'msgfmt exited with return code %s' % p.returncode
|
||||||
assert (test_root / 'xx' / 'LC_MESSAGES' / ('%s.mo' % catalog)
|
assert mo.isfile(), 'msgfmt failed'
|
||||||
).isfile(), 'msgfmt failed'
|
|
||||||
|
|
||||||
|
|
||||||
def teardown_module():
|
def teardown_module():
|
||||||
|
Loading…
Reference in New Issue
Block a user