diff options
author | shimizukawa <shimizukawa@gmail.com> | 2012-12-16 22:56:38 +0900 |
---|---|---|
committer | shimizukawa <shimizukawa@gmail.com> | 2012-12-16 22:56:38 +0900 |
commit | c4e8dfd718af805a9cff0e68cd6ef5d1cee965d2 (patch) | |
tree | 719bda85249bb00f118604894ea29c561672b103 /tests/test_intl.py | |
parent | 657d4a741bfa2ee335d38759d92885c2636d0e71 (diff) | |
download | sphinx-c4e8dfd718af805a9cff0e68cd6ef5d1cee965d2.tar.gz |
Avoid unusable warning in using i18n translation. Closes #1057.
And there is related information at pull request #86
Diffstat (limited to 'tests/test_intl.py')
-rw-r--r-- | tests/test_intl.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_intl.py b/tests/test_intl.py index 30854478..67507ed1 100644 --- a/tests/test_intl.py +++ b/tests/test_intl.py @@ -184,3 +184,25 @@ def test_i18n_keep_external_links(app): if matched: matched_line = matched.group() assert expect_line == matched_line + + +@with_app(buildername='text', warning=warnfile, cleanenv=True, + confoverrides={'language': 'xx', 'locale_dirs': ['.'], + 'gettext_compact': False}) +def test_i18n_literalblock_warning(app): + app.builddir.rmtree(True) #for warnings acceleration + app.builder.build(['i18n/literalblock']) + result = (app.outdir / 'i18n' / 'literalblock.txt').text(encoding='utf-8') + expect = (u"\nI18N WITH LITERAL BLOCK" + u"\n***********************\n" + u"\nCORRECT LITERAL BLOCK:\n" + u"\n this is" + u"\n literal block\n" + u"\nMISSING LITERAL BLOCK:\n" + u"\n<SYSTEM MESSAGE: ") + assert result.startswith(expect) + + warnings = warnfile.getvalue().replace(os.sep, '/') + expected_warning_expr = u'.*/i18n/literalblock.txt:\\d+: ' \ + u'WARNING: Literal block expected; none found.' + assert re.search(expected_warning_expr, warnings) |