Code review changes.
This fixes whitespace and alignment issues, and removes a stray test.
This commit is contained in:
parent
3b10584749
commit
a2bcd68d56
@ -101,7 +101,7 @@ class GUIProcess(QObject):
|
|||||||
stderr = bytes(self._proc.readAllStandardError()).decode('utf-8')
|
stderr = bytes(self._proc.readAllStandardError()).decode('utf-8')
|
||||||
stdout = bytes(self._proc.readAllStandardOutput()).decode('utf-8')
|
stdout = bytes(self._proc.readAllStandardOutput()).decode('utf-8')
|
||||||
|
|
||||||
qutescheme.spawn_output = self.spawn_format(code, status,
|
qutescheme.spawn_output = self._spawn_format(code, status,
|
||||||
stdout, stderr)
|
stdout, stderr)
|
||||||
|
|
||||||
if status == QProcess.CrashExit:
|
if status == QProcess.CrashExit:
|
||||||
@ -122,7 +122,7 @@ class GUIProcess(QObject):
|
|||||||
if stderr:
|
if stderr:
|
||||||
log.procs.error("Process stderr:\n" + stderr.strip())
|
log.procs.error("Process stderr:\n" + stderr.strip())
|
||||||
|
|
||||||
def spawn_format(self, code=0, status=0, stdout="", stderr=""):
|
def _spawn_format(self, code=0, status=0, stdout="", stderr=""):
|
||||||
"""Produce a formatted string for spawn output."""
|
"""Produce a formatted string for spawn output."""
|
||||||
stdout = (stdout or "(No output)").strip()
|
stdout = (stdout or "(No output)").strip()
|
||||||
stderr = (stderr or "(No output)").strip()
|
stderr = (stderr or "(No output)").strip()
|
||||||
|
@ -60,7 +60,7 @@ def test_start(proc, qtbot, message_mock, py_proc):
|
|||||||
proc.start(*argv)
|
proc.start(*argv)
|
||||||
|
|
||||||
assert not message_mock.messages
|
assert not message_mock.messages
|
||||||
assert qutescheme.spawn_output == proc.spawn_format(0, 0, stdout="test")
|
assert qutescheme.spawn_output == proc._spawn_format(stdout="test")
|
||||||
|
|
||||||
|
|
||||||
def test_start_verbose(proc, qtbot, message_mock, py_proc):
|
def test_start_verbose(proc, qtbot, message_mock, py_proc):
|
||||||
@ -77,24 +77,7 @@ def test_start_verbose(proc, qtbot, message_mock, py_proc):
|
|||||||
assert msgs[1].level == usertypes.MessageLevel.info
|
assert msgs[1].level == usertypes.MessageLevel.info
|
||||||
assert msgs[0].text.startswith("Executing:")
|
assert msgs[0].text.startswith("Executing:")
|
||||||
assert msgs[1].text == "Testprocess exited successfully."
|
assert msgs[1].text == "Testprocess exited successfully."
|
||||||
assert qutescheme.spawn_output == proc.spawn_format(0, 0, stdout="test")
|
assert qutescheme.spawn_output == proc._spawn_format(stdout="test")
|
||||||
|
|
||||||
|
|
||||||
def test_start_output(proc, qtbot, message_mock, py_proc):
|
|
||||||
"""Test starting a process verbosely."""
|
|
||||||
proc.verbose = True
|
|
||||||
|
|
||||||
with qtbot.waitSignals([proc.started, proc.finished], timeout=10000,
|
|
||||||
order='strict'):
|
|
||||||
argv = py_proc("import sys; print('test'); sys.exit(0)")
|
|
||||||
proc.start(*argv)
|
|
||||||
|
|
||||||
msgs = message_mock.messages
|
|
||||||
assert msgs[0].level == usertypes.MessageLevel.info
|
|
||||||
assert msgs[1].level == usertypes.MessageLevel.info
|
|
||||||
assert msgs[0].text.startswith("Executing:")
|
|
||||||
assert msgs[1].text == "Testprocess exited successfully."
|
|
||||||
assert qutescheme.spawn_output == proc.spawn_format(0, 0, stdout="test")
|
|
||||||
|
|
||||||
|
|
||||||
def test_start_env(monkeypatch, qtbot, py_proc):
|
def test_start_env(monkeypatch, qtbot, py_proc):
|
||||||
|
Loading…
Reference in New Issue
Block a user