def test_retry_method(retry_times): my_args = ('some', 'new') my_kwargs = {'one': 'first', 'two': 'second'} (flexmock(sys.modules[__name__]).should_call('my_func').with_args( *my_args, **my_kwargs).times(retry_times + 1)) (flexmock(time).should_receive('sleep').and_return(None)) if retry_times >= 0: with pytest.raises(docker.errors.APIError): retry(my_func, *my_args, retry=retry_times, **my_kwargs) else: retry(my_func, *my_args, retry=retry_times, **my_kwargs)
def test_retry_method(retry_times): my_args = ('some', 'new') my_kwargs = {'one': 'first', 'two': 'second'} (flexmock(sys.modules[__name__]) .should_call('my_func') .with_args(*my_args, **my_kwargs) .times(retry_times+1)) (flexmock(time) .should_receive('sleep') .and_return(None)) if retry_times >= 0: with pytest.raises(docker.errors.APIError): retry(my_func, *my_args, retry=retry_times, **my_kwargs) else: retry(my_func, *my_args, retry=retry_times, **my_kwargs)