def test_ignore_abort_ok(): sentinel = object() function = Mock() wrapped = ignore_abort(function) wrapped(sentinel) function.assert_called_once_with(sentinel)
def test_ignore_abort_abort(): sentinel = object() function = Mock(side_effect=WizardAbortError) wrapped = ignore_abort(function) with pytest.raises(SystemExit): wrapped(sentinel) function.assert_called_once_with(sentinel)
def test_ignore_abort_keyboard_interrupt(): sentinel = object() function = Mock(side_effect=KeyboardInterrupt) wrapped = ignore_abort(function) with pytest.raises(SystemExit): wrapped(sentinel) function.assert_called_once_with(sentinel)