Takayuki Shimizukawa avatar Takayuki Shimizukawa committed c2cc7c6

move i18n test documents to i18n subdir.

Comments (0)

Files changed (15)

tests/root/contents.txt

    extensions
    versioning/index
    only
-   i18n_footnote
-   i18n_external_links
-   i18n_refs_inconsistency
+   i18n/index
 
    Python <http://python.org/>
 

tests/root/i18n/external_links.po

+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) 2012, foof
+# This file is distributed under the same license as the foo package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: sphinx 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-11-22 08:28\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "i18n with external links"
+msgstr "EXTERNAL LINKS"
+
+msgid "External link to Python_."
+msgstr "EXTERNAL LINK TO Python_."
+
+msgid "Internal link to `i18n with external links`_."
+msgstr "`EXTERNAL LINKS`_ IS INTERNAL LINK."
+
+msgid "Inline link by `Sphinx <http://sphinx-doc.org>`_."
+msgstr "INLINE LINK BY `SPHINX <http://sphinx-doc.org>`_."
+
+msgid "Unnamed link__."
+msgstr "UNNAMED LINK__."

tests/root/i18n/external_links.txt

+:tocdepth: 2
+
+i18n with external links
+========================
+.. #1044 external-links-dont-work-in-localized-html
+
+* External link to Python_.
+* Internal link to `i18n with external links`_.
+* Inline link by `Sphinx <http://sphinx-doc.org>`_.
+* Unnamed link__.
+
+.. _Python: http://python.org
+.. __: http://google.com

tests/root/i18n/footnote.po

+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) 2012, foof
+# This file is distributed under the same license as the foo package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: sphinx 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-11-22 08:28\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "i18n with Footnote"
+msgstr "I18N WITH FOOTNOTE"
+
+msgid "[100]_ Contents [#]_ for `i18n with Footnote`_ [ref]_"
+msgstr "`I18N WITH FOOTNOTE`_ INCLUDE THIS CONTENTS [ref]_ [#]_ [100]_"
+
+msgid "This is a auto numbered footnote."
+msgstr "THIS IS A AUTO NUMBERED FOOTNOTE."
+
+msgid "This is a named footnote."
+msgstr "THIS IS A NAMED FOOTNOTE."
+
+msgid "This is a numbered footnote."
+msgstr "THIS IS A NUMBERED FOOTNOTE."
+

tests/root/i18n/footnote.txt

+:tocdepth: 2
+
+i18n with Footnote
+==================
+.. #955 cant-build-html-with-footnotes-when-using
+
+[100]_ Contents [#]_ for `i18n with Footnote`_ [ref]_
+
+.. [#] This is a auto numbered footnote.
+.. [ref] This is a named footnote.
+.. [100] This is a numbered footnote.

tests/root/i18n/index.txt

+.. toctree::
+   :maxdepth: 2
+   :numbered:
+
+   footnote
+   external_links
+   refs_inconsistency

tests/root/i18n/refs_inconsistency.po

+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) 2012, foof
+# This file is distributed under the same license as the foo package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: sphinx 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-12-05 08:28\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "i18n with refs inconsistency"
+msgstr "I18N WITH REFS INCONSISTENCY"
+
+msgid "[100]_ for [#]_ footnote [ref2]_."
+msgstr "FOR FOOTNOTE [ref2]_."
+
+msgid "for reference_."
+msgstr "reference_ FOR reference_."
+
+msgid "This is a auto numbered footnote."
+msgstr "THIS IS A AUTO NUMBERED FOOTNOTE."
+
+msgid "This is a named footnote."
+msgstr "THIS IS A NAMED FOOTNOTE."
+
+msgid "This is a numbered footnote."
+msgstr "THIS IS A NUMBERED FOOTNOTE."
+

tests/root/i18n/refs_inconsistency.txt

+:tocdepth: 2
+
+i18n with refs inconsistency
+=============================
+
+* [100]_ for [#]_ footnote [ref2]_.
+* for reference_.
+
+.. [#] This is a auto numbered footnote.
+.. [ref2] This is a named footnote.
+.. [100] This is a numbered footnote.
+.. _reference: http://www.example.com

tests/root/i18n_external_links.po

-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) 2012, foof
-# This file is distributed under the same license as the foo package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: sphinx 1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-11-22 08:28\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-msgid "i18n with external links"
-msgstr "EXTERNAL LINKS"
-
-msgid "External link to Python_."
-msgstr "EXTERNAL LINK TO Python_."
-
-msgid "Internal link to `i18n with external links`_."
-msgstr "`EXTERNAL LINKS`_ IS INTERNAL LINK."
-
-msgid "Inline link by `Sphinx <http://sphinx-doc.org>`_."
-msgstr "INLINE LINK BY `SPHINX <http://sphinx-doc.org>`_."
-
-msgid "Unnamed link__."
-msgstr "UNNAMED LINK__."

tests/root/i18n_external_links.txt

-:tocdepth: 2
-
-i18n with external links
-========================
-.. #1044 external-links-dont-work-in-localized-html
-
-* External link to Python_.
-* Internal link to `i18n with external links`_.
-* Inline link by `Sphinx <http://sphinx-doc.org>`_.
-* Unnamed link__.
-
-.. _Python: http://python.org
-.. __: http://google.com

tests/root/i18n_footnote.po

-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) 2012, foof
-# This file is distributed under the same license as the foo package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: sphinx 1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-11-22 08:28\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-msgid "i18n with Footnote"
-msgstr "I18N WITH FOOTNOTE"
-
-msgid "[100]_ Contents [#]_ for `i18n with Footnote`_ [ref]_"
-msgstr "`I18N WITH FOOTNOTE`_ INCLUDE THIS CONTENTS [ref]_ [#]_ [100]_"
-
-msgid "This is a auto numbered footnote."
-msgstr "THIS IS A AUTO NUMBERED FOOTNOTE."
-
-msgid "This is a named footnote."
-msgstr "THIS IS A NAMED FOOTNOTE."
-
-msgid "This is a numbered footnote."
-msgstr "THIS IS A NUMBERED FOOTNOTE."
-

tests/root/i18n_footnote.txt

-:tocdepth: 2
-
-i18n with Footnote
-==================
-.. #955 cant-build-html-with-footnotes-when-using
-
-[100]_ Contents [#]_ for `i18n with Footnote`_ [ref]_
-
-.. [#] This is a auto numbered footnote.
-.. [ref] This is a named footnote.
-.. [100] This is a numbered footnote.

tests/root/i18n_refs_inconsistency.po

-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) 2012, foof
-# This file is distributed under the same license as the foo package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: sphinx 1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-12-05 08:28\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-msgid "i18n with refs inconsistency"
-msgstr "I18N WITH REFS INCONSISTENCY"
-
-msgid "[100]_ for [#]_ footnote [ref2]_."
-msgstr "FOR FOOTNOTE [ref2]_."
-
-msgid "for reference_."
-msgstr "reference_ FOR reference_."
-
-msgid "This is a auto numbered footnote."
-msgstr "THIS IS A AUTO NUMBERED FOOTNOTE."
-
-msgid "This is a named footnote."
-msgstr "THIS IS A NAMED FOOTNOTE."
-
-msgid "This is a numbered footnote."
-msgstr "THIS IS A NUMBERED FOOTNOTE."
-

tests/root/i18n_refs_inconsistency.txt

-:tocdepth: 2
-
-i18n with refs inconsistency
-=============================
-
-* [100]_ for [#]_ footnote [ref2]_.
-* for reference_.
-
-.. [#] This is a auto numbered footnote.
-.. [ref2] This is a named footnote.
-.. [100] This is a numbered footnote.
-.. _reference: http://www.example.com

tests/test_intl.py

     (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)
     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"
     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"
     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>"""
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.