summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-05-30 12:53:19 +0200
committerFlorian Bruhin <me@the-compiler.org>2021-05-30 12:55:54 +0200
commitc74d1075620f54d8904b9ae822299ba1221450f4 (patch)
treee3df04a6d7620368a1004d6f15e86fdd187c49ad /tests/unit
parentf0d432565bf71919413caf76522d6ad34bb0ebc4 (diff)
downloadqutebrowser-c74d1075620f54d8904b9ae822299ba1221450f4.tar.gz
qutebrowser-c74d1075620f54d8904b9ae822299ba1221450f4.zip
Handle un-encodable initial text for editor
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/misc/test_editor.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit/misc/test_editor.py b/tests/unit/misc/test_editor.py
index cd21308f8..8e5597a0e 100644
--- a/tests/unit/misc/test_editor.py
+++ b/tests/unit/misc/test_editor.py
@@ -148,6 +148,17 @@ class TestFileHandling:
assert msg.text.startswith("Failed to create initial file: ")
assert editor._proc is None
+ def test_encode_error(self, message_mock, editor, caplog, config_stub):
+ """Test file handling when the initial text can't be encoded."""
+ config_stub.val.editor.encoding = 'ascii'
+
+ with caplog.at_level(logging.ERROR):
+ editor.edit("fooƤbar")
+
+ msg = message_mock.getmsg(usertypes.MessageLevel.error)
+ assert msg.text.startswith("Failed to create initial file: ")
+ assert editor._proc is None
+
def test_double_edit(self, editor):
editor.edit("")
with pytest.raises(ValueError):