def test_error(qtbot, proc, caplog, message_mock):
 with caplog.at_level(logging.ERROR, 'message'):
  with qtbot.waitSignal(proc.error, timeout=5000):
   proc.start('this_does_not_exist_either', [])
 msg = message_mock.getmsg(usertypes.MessageLevel.error)
 expected_msg = 'Error while spawning testprocess: The process failed to start.'
 assert (msg.text == expected_msg)

def test_error ( qtbot , proc , caplog , message_mock ) : with caplog . at_level ( logging . ERROR , 'message' ) : with qtbot . waitSignal ( proc . error , timeout = 5000 ) : proc . start ( 'this_does_not_exist_either' , [ ] ) msg = message_mock . getmsg ( usertypes . MessageLevel . error ) expected_msg = 'Error while spawning testprocess: The process failed to start.' assert ( msg . text == expected_msg )
test the process emitting an error .