def test_svn_propget_retry_failure( mocker, tmp_path, sample_repo_with_externals_url, exception_to_retry ): svnrepo = SvnRepo( sample_repo_with_externals_url, sample_repo_with_externals_url, tmp_path, max_content_length=100000, ) checkout_path = os.path.join(tmp_path, "checkout") svnrepo.checkout( sample_repo_with_externals_url, checkout_path, svnrepo.head_revision(), ignore_externals=True, ) mock_sleep = mocker.patch.object(svnrepo.propget.retry, "sleep") nb_failed_calls = SVN_RETRY_MAX_ATTEMPTS svnrepo.client = SVNClientWrapper( svnrepo.client, exception_to_retry, nb_failed_calls ) with pytest.raises(type(exception_to_retry)): svnrepo.propget("svn:externals", checkout_path, None, None, True) assert_sleep_calls(mock_sleep, mocker, nb_failed_calls - 1)
def test_svn_checkout_retry_success( mocker, tmp_path, sample_repo_url, exception_to_retry ): svnrepo = SvnRepo( sample_repo_url, sample_repo_url, tmp_path, max_content_length=100000 ) mock_sleep = mocker.patch.object(svnrepo.checkout.retry, "sleep") nb_failed_calls = 2 svnrepo.client = SVNClientWrapper( svnrepo.client, exception_to_retry, nb_failed_calls ) checkout_path = os.path.join(tmp_path, "checkout") svnrepo.checkout(sample_repo_url, checkout_path, svnrepo.head_revision()) assert os.path.exists(checkout_path) assert_sleep_calls(mock_sleep, mocker, nb_failed_calls)
def test_svn_checkout_retry_failure( mocker, tmp_path, sample_repo_url, exception_to_retry ): svnrepo = SvnRepo( sample_repo_url, sample_repo_url, tmp_path, max_content_length=100000 ) mock_sleep = mocker.patch.object(svnrepo.checkout.retry, "sleep") nb_failed_calls = SVN_RETRY_MAX_ATTEMPTS svnrepo.client = SVNClientWrapper( svnrepo.client, exception_to_retry, nb_failed_calls ) checkout_path = os.path.join(tmp_path, "checkout") with pytest.raises(type(exception_to_retry)): svnrepo.checkout(sample_repo_url, checkout_path, svnrepo.head_revision()) assert not os.path.exists(checkout_path) assert_sleep_calls(mock_sleep, mocker, nb_failed_calls - 1)