summaryrefslogtreecommitdiff
path: root/tests/test_intl.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2016-03-03 23:01:34 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2016-03-03 23:01:34 +0900
commitdda98c7d53592a3f8e8e200e7295e77b5f1eb85d (patch)
tree5ae70a9b59a05bc68ac1760fa914ef32629a6a22 /tests/test_intl.py
parent2a2da13cdef8b05bc034f00433cfc432f0447f7a (diff)
parent657c53b0f571fedcfa4cb347de7573a6dcfd1963 (diff)
downloadsphinx-git-dda98c7d53592a3f8e8e200e7295e77b5f1eb85d.tar.gz
Merge branch 'useless-test-noise'
Diffstat (limited to 'tests/test_intl.py')
-rw-r--r--tests/test_intl.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/tests/test_intl.py b/tests/test_intl.py
index 29d068d65..a2b4f0e3b 100644
--- a/tests/test_intl.py
+++ b/tests/test_intl.py
@@ -24,7 +24,7 @@ from six import string_types
from util import tempdir, rootdir, path, gen_with_app, with_app, SkipTest, \
assert_re_search, assert_not_re_search, assert_in, assert_not_in, \
- assert_startswith, assert_node
+ assert_startswith, assert_node, repr_as
root = tempdir / 'test-intl'
@@ -120,7 +120,7 @@ def test_text_builder(app, status, warning):
# --- warnings in translation
- warnings = warning.getvalue().replace(os.sep, '/')
+ warnings = getwarning(warning)
warning_expr = u'.*/warnings.txt:4: ' \
u'WARNING: Inline literal start-string without end-string.\n'
yield assert_re_search, warning_expr, warnings
@@ -157,7 +157,7 @@ def test_text_builder(app, status, warning):
u"\n[100] THIS IS A NUMBERED FOOTNOTE.\n")
yield assert_equal, result, expect
- warnings = warning.getvalue().replace(os.sep, '/')
+ warnings = getwarning(warning)
warning_fmt = u'.*/refs_inconsistency.txt:\\d+: ' \
u'WARNING: inconsistent %s in translated message\n'
expected_warning_expr = (
@@ -178,7 +178,7 @@ def test_text_builder(app, status, warning):
u"\n<SYSTEM MESSAGE:")
yield assert_startswith, result, expect
- warnings = warning.getvalue().replace(os.sep, '/')
+ warnings = getwarning(warning)
expected_warning_expr = u'.*/literalblock.txt:\\d+: ' \
u'WARNING: Literal block expected; none found.'
yield assert_re_search, expected_warning_expr, warnings
@@ -210,7 +210,7 @@ def test_text_builder(app, status, warning):
u"\n THE CORRESPONDING GLOSSARY #2\n"
u"\nLINK TO *SOME NEW TERM*.\n")
yield assert_equal, result, expect
- warnings = warning.getvalue().replace(os.sep, '/')
+ warnings = getwarning(warning)
yield assert_not_in, 'term not in glossary', warnings
# --- glossary term inconsistencies: regression test for #1090
@@ -221,7 +221,7 @@ def test_text_builder(app, status, warning):
u"\n1. LINK TO *SOME NEW TERM*.\n")
yield assert_equal, result, expect
- warnings = warning.getvalue().replace(os.sep, '/')
+ warnings = getwarning(warning)
expected_warning_expr = (
u'.*/glossary_terms_inconsistency.txt:\\d+: '
u'WARNING: inconsistent term references in translated message\n')
@@ -487,7 +487,7 @@ def test_xml_builder(app, status, warning):
None,
['ref'])
- warnings = warning.getvalue().replace(os.sep, '/')
+ warnings = getwarning(warning)
warning_expr = u'.*/footnote.xml:\\d*: SEVERE: Duplicate ID: ".*".\n'
yield assert_not_re_search, warning_expr, warnings
@@ -618,7 +618,7 @@ def test_xml_builder(app, status, warning):
['same-type-links', 'i18n-role-xref'])
# warnings
- warnings = warning.getvalue().replace(os.sep, '/')
+ warnings = getwarning(warning)
yield assert_not_in, 'term not in glossary', warnings
yield assert_not_in, 'undefined label', warnings
yield assert_not_in, 'unknown document', warnings
@@ -789,6 +789,7 @@ def test_additional_targets_should_be_translated(app, status, warning):
yield assert_count(expected_expr, result, 1)
+<<<<<<< HEAD
@gen_with_intl_app('text', freshenv=True)
def test_references(app, status, warning):
app.builder.build_specific([app.srcdir / 'refs.txt'])
@@ -880,3 +881,7 @@ def test_image_glob_intl_using_figure_language_filename(app, status, warning):
assert_node(doctree[0][3][0], nodes.image, uri='subdir/svgimg.*',
candidates={'application/pdf': 'subdir/svgimg.pdf',
'image/svg+xml': 'subdir/svgimg.svg'})
+
+
+def getwarning(warnings):
+ return repr_as(warnings.getvalue().replace(os.sep, '/'), '<warnings>')