summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshimizukawa <shimizukawa@gmail.com>2012-12-05 13:11:30 +0900
committershimizukawa <shimizukawa@gmail.com>2012-12-05 13:11:30 +0900
commit0b9fc70f916e7fad2a89b7189092746de8c0bb23 (patch)
tree9069b6ab06ebb0dc0eb601ea48fc8c88b2518e78
parentaaa8e2575c7a9bbb8e5d87ed94498386c9df68bf (diff)
downloadsphinx-0b9fc70f916e7fad2a89b7189092746de8c0bb23.tar.gz
refactoring
-rw-r--r--tests/test_intl.py43
1 files changed, 22 insertions, 21 deletions
diff --git a/tests/test_intl.py b/tests/test_intl.py
index 1273df86..ee0ca70a 100644
--- a/tests/test_intl.py
+++ b/tests/test_intl.py
@@ -25,27 +25,28 @@ warnfile = StringIO()
def setup_module():
(test_root / 'xx' / 'LC_MESSAGES').makedirs()
# Compile all required catalogs into binary format (*.mo).
- for catalog in ('bom', 'subdir', 'i18n_footnote', 'i18n_external_links',
- 'i18n_refs_inconsistency'):
- try:
- p = Popen(['msgfmt', test_root / '%s.po' % catalog, '-o',
- test_root / 'xx' / 'LC_MESSAGES' / '%s.mo' % catalog],
- stdout=PIPE, stderr=PIPE)
- except OSError:
- # The test will fail the second time it's run if we don't
- # tear down here. Not sure if there's a more idiomatic way
- # of ensuring that teardown gets run in the event of an
- # exception from the setup function.
- teardown_module()
- raise SkipTest # 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' / ('%s.mo' % catalog)
- ).isfile(), 'msgfmt failed'
+ for dirpath, dirs, files in os.walk(test_root):
+ 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:
+ p = Popen(['msgfmt', po, '-o', mo],
+ stdout=PIPE, stderr=PIPE)
+ except OSError:
+ # The test will fail the second time it's run if we don't
+ # tear down here. Not sure if there's a more idiomatic way
+ # of ensuring that teardown gets run in the event of an
+ # exception from the setup function.
+ teardown_module()
+ raise SkipTest # 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 mo.isfile(), 'msgfmt failed'
def teardown_module():