def test_err_zero_return_code(self, mock_popen, mock_error, mock_debug): """ Ensures proper behavior when there is err output, but the exit code is 0. See https://github.com/fedora-infra/bodhi/issues/1412 """ mock_popen.return_value = mock.Mock() mock_popen_obj = mock_popen.return_value mock_popen_obj.communicate.return_value = ('output', 'error') mock_popen_obj.returncode = 0 util.cmd('/bin/echo', '"home/imgs/catpix"') mock_popen.assert_called_once_with(['/bin/echo'], cwd='"home/imgs/catpix"', stdout=subprocess.PIPE, stderr=subprocess.PIPE) mock_error.assert_not_called() mock_debug.assert_called_with('error')
def test_cmd_failure(self): try: util.cmd('false') assert False except Exception: pass