summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshimizukawa <shimizukawa@gmail.com>2012-12-05 13:38:04 +0900
committershimizukawa <shimizukawa@gmail.com>2012-12-05 13:38:04 +0900
commit2dc101a81084996abb8a1543ef1933770b859aea (patch)
treeaccbcd3fb013393e2df5fa83a7b27041bba8a90f
parent0b9fc70f916e7fad2a89b7189092746de8c0bb23 (diff)
downloadsphinx-2dc101a81084996abb8a1543ef1933770b859aea.tar.gz
move i18n test documents to i18n subdir.
-rw-r--r--tests/root/contents.txt4
-rw-r--r--tests/root/i18n/external_links.po (renamed from tests/root/i18n_external_links.po)0
-rw-r--r--tests/root/i18n/external_links.txt (renamed from tests/root/i18n_external_links.txt)0
-rw-r--r--tests/root/i18n/footnote.po (renamed from tests/root/i18n_footnote.po)0
-rw-r--r--tests/root/i18n/footnote.txt (renamed from tests/root/i18n_footnote.txt)0
-rw-r--r--tests/root/i18n/index.txt7
-rw-r--r--tests/root/i18n/refs_inconsistency.po (renamed from tests/root/i18n_refs_inconsistency.po)0
-rw-r--r--tests/root/i18n/refs_inconsistency.txt (renamed from tests/root/i18n_refs_inconsistency.txt)0
-rw-r--r--tests/test_intl.py43
9 files changed, 33 insertions, 21 deletions
diff --git a/tests/root/contents.txt b/tests/root/contents.txt
index 04dd8481..0a8ca00e 100644
--- a/tests/root/contents.txt
+++ b/tests/root/contents.txt
@@ -28,9 +28,7 @@ Contents:
extensions
versioning/index
only
- i18n_footnote
- i18n_external_links
- i18n_refs_inconsistency
+ i18n/index
Python <http://python.org/>
diff --git a/tests/root/i18n_external_links.po b/tests/root/i18n/external_links.po
index 4cd19dda..4cd19dda 100644
--- a/tests/root/i18n_external_links.po
+++ b/tests/root/i18n/external_links.po
diff --git a/tests/root/i18n_external_links.txt b/tests/root/i18n/external_links.txt
index 7ac1db02..7ac1db02 100644
--- a/tests/root/i18n_external_links.txt
+++ b/tests/root/i18n/external_links.txt
diff --git a/tests/root/i18n_footnote.po b/tests/root/i18n/footnote.po
index 47f8d3db..47f8d3db 100644
--- a/tests/root/i18n_footnote.po
+++ b/tests/root/i18n/footnote.po
diff --git a/tests/root/i18n_footnote.txt b/tests/root/i18n/footnote.txt
index 3ef76bba..3ef76bba 100644
--- a/tests/root/i18n_footnote.txt
+++ b/tests/root/i18n/footnote.txt
diff --git a/tests/root/i18n/index.txt b/tests/root/i18n/index.txt
new file mode 100644
index 00000000..f35e2766
--- /dev/null
+++ b/tests/root/i18n/index.txt
@@ -0,0 +1,7 @@
+.. toctree::
+ :maxdepth: 2
+ :numbered:
+
+ footnote
+ external_links
+ refs_inconsistency
diff --git a/tests/root/i18n_refs_inconsistency.po b/tests/root/i18n/refs_inconsistency.po
index 947190c7..947190c7 100644
--- a/tests/root/i18n_refs_inconsistency.po
+++ b/tests/root/i18n/refs_inconsistency.po
diff --git a/tests/root/i18n_refs_inconsistency.txt b/tests/root/i18n/refs_inconsistency.txt
index 24bd5592..24bd5592 100644
--- a/tests/root/i18n_refs_inconsistency.txt
+++ b/tests/root/i18n/refs_inconsistency.txt
diff --git a/tests/test_intl.py b/tests/test_intl.py
index ee0ca70a..47f6f1f5 100644
--- a/tests/test_intl.py
+++ b/tests/test_intl.py
@@ -26,10 +26,13 @@ def setup_module():
(test_root / 'xx' / 'LC_MESSAGES').makedirs()
# Compile all required catalogs into binary format (*.mo).
for dirpath, dirs, files in os.walk(test_root):
+ dirpath = path(dirpath)
for f in [f for f in files if f.endswith('.po')]:
- po = os.path.join(dirpath, f)
+ po = dirpath / f
mo = test_root / 'xx' / 'LC_MESSAGES' / (
os.path.relpath(po[:-3], test_root) + '.mo')
+ if not mo.parent.exists():
+ mo.parent.makedirs()
try:
p = Popen(['msgfmt', po, '-o', mo],
stdout=PIPE, stderr=PIPE)
@@ -73,21 +76,23 @@ def test_subdir(app):
assert result.startswith(u"\ntranslation\n***********\n\n")
-@with_app(buildername='html',
- confoverrides={'language': 'xx', 'locale_dirs': ['.']})
+@with_app(buildername='html', cleanenv=True,
+ confoverrides={'language': 'xx', 'locale_dirs': ['.'],
+ 'gettext_compact': False})
def test_i18n_footnote_break_refid(app):
"""test for #955 cant-build-html-with-footnotes-when-using"""
- app.builder.build(['i18n_footnote'])
- result = (app.outdir / 'i18n_footnote.html').text(encoding='utf-8')
+ app.builder.build(['i18n/footnote'])
+ result = (app.outdir / 'i18n' / 'footnote.html').text(encoding='utf-8')
# expect no error by build
-@with_app(buildername='text',
- confoverrides={'language': 'xx', 'locale_dirs': ['.']})
+@with_app(buildername='text', cleanenv=True,
+ confoverrides={'language': 'xx', 'locale_dirs': ['.'],
+ 'gettext_compact': False})
def test_i18n_footnote_regression(app):
"""regression test for fix #955"""
- app.builder.build(['i18n_footnote'])
- result = (app.outdir / 'i18n_footnote.txt').text(encoding='utf-8')
+ app.builder.build(['i18n/footnote'])
+ result = (app.outdir / 'i18n' / 'footnote.txt').text(encoding='utf-8')
expect = (u"\nI18N WITH FOOTNOTE"
u"\n******************\n" # underline matches new translation
u"\nI18N WITH FOOTNOTE INCLUDE THIS CONTENTS [ref] [1] [100]\n"
@@ -97,12 +102,13 @@ def test_i18n_footnote_regression(app):
assert result == expect
-@with_app(buildername='text', warning=warnfile,
- confoverrides={'language': 'xx', 'locale_dirs': ['.']})
+@with_app(buildername='text', warning=warnfile, cleanenv=True,
+ confoverrides={'language': 'xx', 'locale_dirs': ['.'],
+ 'gettext_compact': False})
def test_i18n_warn_for_number_of_references_inconsistency(app):
app.builddir.rmtree(True)
- app.builder.build(['i18n_refs_inconsistency'])
- result = (app.outdir / 'i18n_refs_inconsistency.txt').text(encoding='utf-8')
+ app.builder.build(['i18n/refs_inconsistency'])
+ result = (app.outdir / 'i18n' / 'refs_inconsistency.txt').text(encoding='utf-8')
expect = (u"\nI18N WITH REFS INCONSISTENCY"
u"\n****************************\n"
u"\n* [100] for [1] footnote [ref2].\n"
@@ -113,16 +119,17 @@ def test_i18n_warn_for_number_of_references_inconsistency(app):
assert result == expect
warnings = warnfile.getvalue().replace(os.sep, '/')
- expected_warning_expr = "i18n_refs_inconsistency.txt:\d+: WARNING: The number of reference are inconsistent in both the translated form and the untranslated form. skip translation."
+ expected_warning_expr = "i18n/refs_inconsistency.txt:\d+: WARNING: The number of reference are inconsistent in both the translated form and the untranslated form. skip translation."
assert len(re.findall(expected_warning_expr, warnings)) == 2
-@with_app(buildername='html',
- confoverrides={'language': 'xx', 'locale_dirs': ['.']})
+@with_app(buildername='html', cleanenv=True,
+ confoverrides={'language': 'xx', 'locale_dirs': ['.'],
+ 'gettext_compact': False})
def test_i18n_keep_external_links(app):
"""regression test for #1044"""
- app.builder.build(['i18n_external_links'])
- result = (app.outdir / 'i18n_external_links.html').text(encoding='utf-8')
+ app.builder.build(['i18n/external_links'])
+ result = (app.outdir / 'i18n' / 'external_links.html').text(encoding='utf-8')
# external link check
expect_line = u"""<li>EXTERNAL LINK TO <a class="reference external" href="http://python.org">Python</a>.</li>"""