def test_start_detached_error(fake_proc, message_mock, caplog):
 argv = ['foo', 'bar']
 fake_proc._proc.startDetached.return_value = (False, 0)
 fake_proc._proc.error.return_value = 'Error message'
 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.')

def test_start_detached_error ( fake_proc , message_mock , caplog ) : argv = [ 'foo' , 'bar' ] fake_proc . _proc . startDetached . return_value = ( False , 0 ) fake_proc . _proc . error . return_value = 'Error message' 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.' )
test starting a detached process with ok=false .