summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2015-09-11 08:32:16 +0200
committerFlorian Bruhin <git@the-compiler.org>2015-09-11 08:32:16 +0200
commitc77956c9c583e0c29754468e3ba6b6d7642d7989 (patch)
tree51b4d70202e49cd44938becf3483b7ba6190df69
parent28c8e4acbf9307c29fb82f5657c6b48610dae332 (diff)
downloadqutebrowser-c77956c9c583e0c29754468e3ba6b6d7642d7989.tar.gz
qutebrowser-c77956c9c583e0c29754468e3ba6b6d7642d7989.zip
Fix GUIProcess tests.
The logging checks were of little use and some tests were basically duplicated.
-rw-r--r--tests/unit/misc/test_editor.py31
1 files changed, 7 insertions, 24 deletions
diff --git a/tests/unit/misc/test_editor.py b/tests/unit/misc/test_editor.py
index 8e1971ce5..3402e9b5c 100644
--- a/tests/unit/misc/test_editor.py
+++ b/tests/unit/misc/test_editor.py
@@ -86,24 +86,23 @@ class TestFileHandling:
editor._proc.finished.emit(0, QProcess.NormalExit)
assert not os.path.exists(filename)
- def test_error(self, caplog, editor):
+ def test_error(self, editor):
"""Test file handling when closing with an exit status != 0."""
editor.edit("")
filename = editor._filename
assert os.path.exists(filename)
- with caplog.atLevel(logging.ERROR):
- editor._proc.finished.emit(1, QProcess.NormalExit)
- assert len(caplog.records()) == 2
+
+ editor._proc.finished.emit(1, QProcess.NormalExit)
+
assert not os.path.exists(filename)
- def test_crash(self, caplog, editor):
+ def test_crash(self, editor):
"""Test file handling when closing with a crash."""
editor.edit("")
filename = editor._filename
assert os.path.exists(filename)
- with caplog.atLevel(logging.ERROR):
- editor._proc.error.emit(QProcess.Crashed)
- assert len(caplog.records()) == 2
+ editor._proc.error.emit(QProcess.Crashed)
+
editor._proc.finished.emit(0, QProcess.CrashExit)
assert not os.path.exists(filename)
@@ -154,19 +153,3 @@ def test_modify(editor, initial_text, edited_text):
editor._proc.finished.emit(0, QProcess.NormalExit)
editor.editing_finished.emit.assert_called_with(edited_text)
-
-
-def test_proc_error(caplog, editor):
- """Test on_proc_error."""
- editor.edit("")
- with caplog.atLevel(logging.ERROR):
- editor.on_proc_error(QProcess.Crashed)
- assert len(caplog.records()) == 2
-
-
-def test_proc_return(caplog, editor):
- """Test on_proc_finished with a bad exit status."""
- editor.edit("")
- with caplog.atLevel(logging.ERROR):
- editor.on_proc_closed(1, QProcess.NormalExit)
- assert len(caplog.records()) == 2