Fix tests for QProcess changes

This commit is contained in:
Florian Bruhin 2017-07-23 22:10:50 +02:00
parent 7d10e47046
commit 56b4989f44
3 changed files with 5 additions and 8 deletions

View File

@ -154,7 +154,7 @@ class GUIProcess(QObject):
log.procs.debug("Process started.")
self._started = True
else:
message.error("Error while spawning {}: {}.".format(
message.error("Error while spawning {}: {}".format(
self._what, ERROR_STRINGS[self._proc.error()]))
def exit_status(self):

View File

@ -60,8 +60,3 @@ Feature: :spawn
Scenario: Running :spawn with userscript that expects the stdin getting closed
When I run :spawn -u (testdata)/userscripts/stdinclose.py
Then the message "stdin closed" should be shown
@posix
Scenario: Running :spawn -d with userscript that expects the stdin getting closed
When I run :spawn -d -u (testdata)/userscripts/stdinclose.py
Then the message "stdin closed" should be shown

View File

@ -128,11 +128,13 @@ def test_start_detached_error(fake_proc, message_mock, caplog):
"""Test starting a detached process with ok=False."""
argv = ['foo', 'bar']
fake_proc._proc.startDetached.return_value = (False, 0)
fake_proc._proc.error.return_value = "Error message"
fake_proc._proc.error.return_value = QProcess.FailedToStart
with caplog.at_level(logging.ERROR):
fake_proc.start_detached(*argv)
msg = message_mock.getmsg(usertypes.MessageLevel.error)
assert msg.text == "Error while spawning testprocess: Error message."
expected = ("Error while spawning testprocess: The process failed to "
"start.")
assert msg.text == expected
def test_double_start(qtbot, proc, py_proc):