summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2019-05-27 12:30:01 +0300
committerAarni Koskela <akx@iki.fi>2019-05-27 13:09:57 +0300
commitceb074a8f94e4a0d33bdab3ba54803488c0ce682 (patch)
tree721d5be8cb4976c88dd4ceae77d64a0f78ab0025 /tests
parent665c2ac12b95267383e726722d861e54f2d04fee (diff)
downloadbabel-ceb074a8f94e4a0d33bdab3ba54803488c0ce682.tar.gz
pybabel compile: exit with code 1 if errors were encountered
Fixes #627
Diffstat (limited to 'tests')
-rw-r--r--tests/messages/data/project/i18n/fi_BUGGY/LC_MESSAGES/messages.po5
-rw-r--r--tests/messages/test_frontend.py9
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/messages/data/project/i18n/fi_BUGGY/LC_MESSAGES/messages.po b/tests/messages/data/project/i18n/fi_BUGGY/LC_MESSAGES/messages.po
new file mode 100644
index 0000000..0a0745b
--- /dev/null
+++ b/tests/messages/data/project/i18n/fi_BUGGY/LC_MESSAGES/messages.po
@@ -0,0 +1,5 @@
+msgid ""
+msgstr ""
+
+msgid "bar %(sign)s"
+msgstr "tanko %(merkki)s"
diff --git a/tests/messages/test_frontend.py b/tests/messages/test_frontend.py
index fa0112c..deaa660 100644
--- a/tests/messages/test_frontend.py
+++ b/tests/messages/test_frontend.py
@@ -1383,3 +1383,12 @@ def test_extract_add_location():
assert isinstance(cmdinst, extract_messages)
assert cmdinst.add_location == 'never'
assert cmdinst.no_location
+
+
+def test_extract_error_code(monkeypatch, capsys):
+ monkeypatch.chdir(project_dir)
+ cmdinst = configure_cli_command("compile --domain=messages --directory i18n --locale fi_BUGGY")
+ assert cmdinst.run() == 1
+ out, err = capsys.readouterr()
+ # replace hack below for py2/py3 compatibility
+ assert "unknown named placeholder 'merkki'" in err.replace("u'", "'")