summaryrefslogtreecommitdiff
path: root/tests/unit/misc/test_editor.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/misc/test_editor.py')
-rw-r--r--tests/unit/misc/test_editor.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/unit/misc/test_editor.py b/tests/unit/misc/test_editor.py
index bec775add..4fd915062 100644
--- a/tests/unit/misc/test_editor.py
+++ b/tests/unit/misc/test_editor.py
@@ -26,7 +26,7 @@ import os
import logging
import pytest
-from PyQt5.QtCore import QProcess
+from qutebrowser.qt.core import QProcess
from qutebrowser.misc import editor as editormod
from qutebrowser.utils import usertypes
@@ -81,7 +81,7 @@ class TestFileHandling:
filename = pathlib.Path(editor._filename)
assert filename.exists()
assert filename.name.startswith('qutebrowser-editor-')
- editor._proc._proc.finished.emit(0, QProcess.NormalExit)
+ editor._proc._proc.finished.emit(0, QProcess.ExitStatus.NormalExit)
assert filename.exists() != config_stub.val.editor.remove_file
@pytest.mark.parametrize('touch', [True, False])
@@ -92,7 +92,7 @@ class TestFileHandling:
path.touch()
editor.edit_file(str(path))
- editor._proc._proc.finished.emit(0, QProcess.NormalExit)
+ editor._proc._proc.finished.emit(0, QProcess.ExitStatus.NormalExit)
assert path.exists()
@@ -103,7 +103,7 @@ class TestFileHandling:
assert filename.exists()
with caplog.at_level(logging.ERROR):
- editor._proc._proc.finished.emit(1, QProcess.NormalExit)
+ editor._proc._proc.finished.emit(1, QProcess.ExitStatus.NormalExit)
assert filename.exists()
@@ -115,9 +115,9 @@ class TestFileHandling:
filename = pathlib.Path(editor._filename)
assert filename.exists()
- editor._proc.error.emit(QProcess.Crashed)
+ editor._proc.error.emit(QProcess.ProcessError.Crashed)
with caplog.at_level(logging.ERROR):
- editor._proc._proc.finished.emit(0, QProcess.CrashExit)
+ editor._proc._proc.finished.emit(0, QProcess.ExitStatus.CrashExit)
assert filename.exists()
filename.unlink()
@@ -133,7 +133,7 @@ class TestFileHandling:
pytest.skip("File was still readable")
with caplog.at_level(logging.ERROR):
- editor._proc._proc.finished.emit(0, QProcess.NormalExit)
+ editor._proc._proc.finished.emit(0, QProcess.ExitStatus.NormalExit)
assert not filename.exists()
msg = message_mock.getmsg(usertypes.MessageLevel.error)
assert msg.text.startswith("Failed to read back edited file: ")
@@ -181,7 +181,7 @@ class TestFileHandling:
fname = msg.text[len(prefix):]
with qtbot.wait_signal(editor.editing_finished):
- editor._proc._proc.finished.emit(0, QProcess.NormalExit)
+ editor._proc._proc.finished.emit(0, QProcess.ExitStatus.NormalExit)
with open(fname, 'r', encoding='utf-8') as f:
assert f.read() == 'bar'
@@ -224,7 +224,7 @@ def test_modify(qtbot, editor, initial_text, edited_text):
f.write(edited_text)
with qtbot.wait_signal(editor.file_updated) as blocker:
- editor._proc._proc.finished.emit(0, QProcess.NormalExit)
+ editor._proc._proc.finished.emit(0, QProcess.ExitStatus.NormalExit)
assert blocker.args == [edited_text]
@@ -258,7 +258,7 @@ def test_modify_watch(qtbot):
assert blocker.args == ['baz']
with qtbot.assert_not_emitted(editor.file_updated):
- editor._proc._proc.finished.emit(0, QProcess.NormalExit)
+ editor._proc._proc.finished.emit(0, QProcess.ExitStatus.NormalExit)
def test_failing_watch(qtbot, caplog, monkeypatch):
@@ -276,7 +276,7 @@ def test_failing_watch(qtbot, caplog, monkeypatch):
_update_file(editor._filename, 'bar')
with qtbot.wait_signal(editor.file_updated) as blocker:
- editor._proc._proc.finished.emit(0, QProcess.NormalExit)
+ editor._proc._proc.finished.emit(0, QProcess.ExitStatus.NormalExit)
assert blocker.args == ['bar']
message = 'Failed to watch path: {}'.format(editor._filename)
@@ -293,7 +293,7 @@ def test_failing_unwatch(qtbot, caplog, monkeypatch):
editor.edit('foo')
with caplog.at_level(logging.ERROR):
- editor._proc._proc.finished.emit(0, QProcess.NormalExit)
+ editor._proc._proc.finished.emit(0, QProcess.ExitStatus.NormalExit)
message = 'Failed to unwatch paths: [{!r}]'.format(editor._filename)
assert caplog.messages[-1] == message