summaryrefslogtreecommitdiff
path: root/tests/test_util_i18n.py
diff options
context:
space:
mode:
authorJulien Palard <julien@palard.fr>2018-05-01 22:57:32 +0200
committerJulien Palard <julien@palard.fr>2018-05-08 11:02:14 +0200
commit6dcdce685dbcefa8021a9e06819318fc640ef4a8 (patch)
tree7e14f8af811bfc84c9a3bb73a9af2d96fcedb4c7 /tests/test_util_i18n.py
parentcb8c65932033b04fba6b79d20958661df7a1ddad (diff)
downloadsphinx-git-6dcdce685dbcefa8021a9e06819318fc640ef4a8.tar.gz
i18n: Ignore dot-directories like .git/ in LC_MESSAGES/.
This avoids warnings when find_catalog_source_files returns files found in .git/ like: WARNING: Start of line didn't match any expected keyword./refs/heads/freezed-library/colorsys.mo WARNING: Problem on line 1: 0000000000000000000000000000000000000000 032a00a7391ec8a155bbc54d66ba72fb1b7bdbf1 Julien Palard <julien@palard.fr> 1521582790 +0100 branch: Created from freezed/library/colorsys.po `.po` files can typically reside in .git/refs/heads/ if some branches name end with .po, in which case they contain a SHA1, not translations, leading to warnings.
Diffstat (limited to 'tests/test_util_i18n.py')
-rw-r--r--tests/test_util_i18n.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_util_i18n.py b/tests/test_util_i18n.py
index 1ae6dcb67..da8abe265 100644
--- a/tests/test_util_i18n.py
+++ b/tests/test_util_i18n.py
@@ -157,6 +157,17 @@ def test_get_catalogs_with_compact(tempdir):
assert domains == set(['test1', 'test2', 'sub'])
+def test_get_catalogs_excluded(tempdir):
+ (tempdir / 'loc1' / 'en' / 'LC_MESSAGES' / '.git').makedirs()
+ (tempdir / 'loc1' / 'en' / 'LC_MESSAGES' / 'en_dom.po').write_text('#')
+ (tempdir / 'loc1' / 'en' / 'LC_MESSAGES' / '.git' / 'no_no.po').write_text('#')
+
+ catalogs = i18n.find_catalog_source_files(
+ [tempdir / 'loc1'], 'en', force_all=False, excluded=lambda path: '.git' in path)
+ domains = set(c.domain for c in catalogs)
+ assert domains == set(['en_dom'])
+
+
def test_format_date():
date = datetime.date(2016, 2, 7)