Пример #1
0
def test_retry_on_error_success(monkeypatch: MonkeyPatch):
    monkeypatch.setattr(interactive.questionary, "confirm",
                        QuestionaryConfirmMock(3))

    m = Mock(return_value=None)
    interactive._retry_on_error(m, "export_path", 1, a=2)
    m.assert_called_once_with("export_path", 1, a=2)
Пример #2
0
def test_retry_on_error_three_retries(monkeypatch: MonkeyPatch):
    monkeypatch.setattr(interactive.questionary, "confirm", QuestionaryConfirmMock(3))

    m = Mock(side_effect=PermissionError())
    with pytest.raises(PermissionError):
        interactive._retry_on_error(m, "export_path", 1, a=2)
    c = mock.call("export_path", 1, a=2)
    m.assert_has_calls([c, c, c])