From 2dc101a81084996abb8a1543ef1933770b859aea Mon Sep 17 00:00:00 2001 From: shimizukawa Date: Wed, 5 Dec 2012 13:38:04 +0900 Subject: move i18n test documents to i18n subdir. --- tests/root/contents.txt | 4 +--- tests/root/i18n/external_links.po | 32 +++++++++++++++++++++++++ tests/root/i18n/external_links.txt | 13 ++++++++++ tests/root/i18n/footnote.po | 33 ++++++++++++++++++++++++++ tests/root/i18n/footnote.txt | 11 +++++++++ tests/root/i18n/index.txt | 7 ++++++ tests/root/i18n/refs_inconsistency.po | 36 ++++++++++++++++++++++++++++ tests/root/i18n/refs_inconsistency.txt | 12 ++++++++++ tests/root/i18n_external_links.po | 32 ------------------------- tests/root/i18n_external_links.txt | 13 ---------- tests/root/i18n_footnote.po | 33 -------------------------- tests/root/i18n_footnote.txt | 11 --------- tests/root/i18n_refs_inconsistency.po | 36 ---------------------------- tests/root/i18n_refs_inconsistency.txt | 12 ---------- tests/test_intl.py | 43 ++++++++++++++++++++-------------- 15 files changed, 170 insertions(+), 158 deletions(-) create mode 100644 tests/root/i18n/external_links.po create mode 100644 tests/root/i18n/external_links.txt create mode 100644 tests/root/i18n/footnote.po create mode 100644 tests/root/i18n/footnote.txt create mode 100644 tests/root/i18n/index.txt create mode 100644 tests/root/i18n/refs_inconsistency.po create mode 100644 tests/root/i18n/refs_inconsistency.txt delete mode 100644 tests/root/i18n_external_links.po delete mode 100644 tests/root/i18n_external_links.txt delete mode 100644 tests/root/i18n_footnote.po delete mode 100644 tests/root/i18n_footnote.txt delete mode 100644 tests/root/i18n_refs_inconsistency.po delete mode 100644 tests/root/i18n_refs_inconsistency.txt 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 diff --git a/tests/root/i18n/external_links.po b/tests/root/i18n/external_links.po new file mode 100644 index 00000000..4cd19dda --- /dev/null +++ b/tests/root/i18n/external_links.po @@ -0,0 +1,32 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , 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 \n" +"Language-Team: LANGUAGE \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 `_." +msgstr "INLINE LINK BY `SPHINX `_." + +msgid "Unnamed link__." +msgstr "UNNAMED LINK__." diff --git a/tests/root/i18n/external_links.txt b/tests/root/i18n/external_links.txt new file mode 100644 index 00000000..7ac1db02 --- /dev/null +++ b/tests/root/i18n/external_links.txt @@ -0,0 +1,13 @@ +: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 `_. +* Unnamed link__. + +.. _Python: http://python.org +.. __: http://google.com diff --git a/tests/root/i18n/footnote.po b/tests/root/i18n/footnote.po new file mode 100644 index 00000000..47f8d3db --- /dev/null +++ b/tests/root/i18n/footnote.po @@ -0,0 +1,33 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , 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 \n" +"Language-Team: LANGUAGE \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." + diff --git a/tests/root/i18n/footnote.txt b/tests/root/i18n/footnote.txt new file mode 100644 index 00000000..3ef76bba --- /dev/null +++ b/tests/root/i18n/footnote.txt @@ -0,0 +1,11 @@ +: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. 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 new file mode 100644 index 00000000..947190c7 --- /dev/null +++ b/tests/root/i18n/refs_inconsistency.po @@ -0,0 +1,36 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , 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 \n" +"Language-Team: LANGUAGE \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." + diff --git a/tests/root/i18n/refs_inconsistency.txt b/tests/root/i18n/refs_inconsistency.txt new file mode 100644 index 00000000..24bd5592 --- /dev/null +++ b/tests/root/i18n/refs_inconsistency.txt @@ -0,0 +1,12 @@ +: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 diff --git a/tests/root/i18n_external_links.po b/tests/root/i18n_external_links.po deleted file mode 100644 index 4cd19dda..00000000 --- a/tests/root/i18n_external_links.po +++ /dev/null @@ -1,32 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2012, foof -# This file is distributed under the same license as the foo package. -# FIRST AUTHOR , 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 \n" -"Language-Team: LANGUAGE \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 `_." -msgstr "INLINE LINK BY `SPHINX `_." - -msgid "Unnamed link__." -msgstr "UNNAMED LINK__." diff --git a/tests/root/i18n_external_links.txt b/tests/root/i18n_external_links.txt deleted file mode 100644 index 7ac1db02..00000000 --- a/tests/root/i18n_external_links.txt +++ /dev/null @@ -1,13 +0,0 @@ -: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 `_. -* Unnamed link__. - -.. _Python: http://python.org -.. __: http://google.com diff --git a/tests/root/i18n_footnote.po b/tests/root/i18n_footnote.po deleted file mode 100644 index 47f8d3db..00000000 --- a/tests/root/i18n_footnote.po +++ /dev/null @@ -1,33 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2012, foof -# This file is distributed under the same license as the foo package. -# FIRST AUTHOR , 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 \n" -"Language-Team: LANGUAGE \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." - diff --git a/tests/root/i18n_footnote.txt b/tests/root/i18n_footnote.txt deleted file mode 100644 index 3ef76bba..00000000 --- a/tests/root/i18n_footnote.txt +++ /dev/null @@ -1,11 +0,0 @@ -: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. diff --git a/tests/root/i18n_refs_inconsistency.po b/tests/root/i18n_refs_inconsistency.po deleted file mode 100644 index 947190c7..00000000 --- a/tests/root/i18n_refs_inconsistency.po +++ /dev/null @@ -1,36 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2012, foof -# This file is distributed under the same license as the foo package. -# FIRST AUTHOR , 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 \n" -"Language-Team: LANGUAGE \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." - diff --git a/tests/root/i18n_refs_inconsistency.txt b/tests/root/i18n_refs_inconsistency.txt deleted file mode 100644 index 24bd5592..00000000 --- a/tests/root/i18n_refs_inconsistency.txt +++ /dev/null @@ -1,12 +0,0 @@ -: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 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"""
  • EXTERNAL LINK TO Python.
  • """ -- cgit v1.2.1