Skip to content

Commit

Permalink
Revert "Update urllib version"
Browse files Browse the repository at this point in the history
This reverts commit dfeac86.

This is because the urllib version on brew builders is lower than 1.26 and there is not an easy way to enforce/install a version of 1.26.19

Signed-off-by: mkosiarc <mkosiarc@redhat.com>
  • Loading branch information
mkosiarc committed Sep 6, 2024
1 parent d9ab54c commit 5795282
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion osbs/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
HTTP_RETRIES_STATUS_FORCELIST = [408, 500, 502, 503, 504]

# HTTP methods that we should retry on
HTTP_RETRIES_ALLOWED_METHODS = ['GET', 'PUT', 'POST', 'DELETE']
HTTP_RETRIES_METHODS_WHITELIST = ['GET', 'PUT', 'POST', 'DELETE']

# requests timeout in seconds
HTTP_REQUEST_TIMEOUT = 600
Expand Down
4 changes: 2 additions & 2 deletions osbs/osbs_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from osbs.exceptions import OsbsException, OsbsNetworkException, OsbsResponseException
from osbs.constants import (
HTTP_MAX_RETRIES, HTTP_BACKOFF_FACTOR, HTTP_RETRIES_STATUS_FORCELIST,
HTTP_RETRIES_ALLOWED_METHODS, HTTP_REQUEST_TIMEOUT)
HTTP_RETRIES_METHODS_WHITELIST, HTTP_REQUEST_TIMEOUT)

import requests
from requests.adapters import HTTPAdapter
Expand Down Expand Up @@ -111,7 +111,7 @@ def log_error_response_text_hook(resp, *args, **kwargs):
read=HTTP_MAX_RETRIES,
backoff_factor=HTTP_BACKOFF_FACTOR,
status_forcelist=HTTP_RETRIES_STATUS_FORCELIST,
allowed_methods=HTTP_RETRIES_ALLOWED_METHODS,
method_whitelist=HTTP_RETRIES_METHODS_WHITELIST,
raise_on_status=False,
)
self.session = requests.Session()
Expand Down
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
flexmock>=0.11.0
urllib3>=1.26.19
urllib3<1.26
pytest==7.0.1
pytest-cov
pytest-html
Expand Down
4 changes: 2 additions & 2 deletions tests/test_retries.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import requests
from urllib3.util import Retry
from osbs.exceptions import OsbsNetworkException, OsbsResponseException
from osbs.constants import HTTP_RETRIES_STATUS_FORCELIST, HTTP_RETRIES_ALLOWED_METHODS
from osbs.constants import HTTP_RETRIES_STATUS_FORCELIST, HTTP_RETRIES_METHODS_WHITELIST
from osbs.osbs_http import HttpSession, HttpStream
from osbs import osbs_http
logger = logging.getLogger(__file__)
Expand Down Expand Up @@ -49,7 +49,7 @@ def has_connection():
reason="requires internet connection")
class TestHttpRetries(object):
@pytest.mark.parametrize('status_code', HTTP_RETRIES_STATUS_FORCELIST)
@pytest.mark.parametrize('method', HTTP_RETRIES_ALLOWED_METHODS)
@pytest.mark.parametrize('method', HTTP_RETRIES_METHODS_WHITELIST)
def test_fail_after_retries(self, s, status_code, method):
flexmock(osbs_http).should_receive('Retry').and_return(fake_retry)
# latest python-requests throws OsbsResponseException, 2.6.x - OsbsNetworkException
Expand Down

0 comments on commit 5795282

Please sign in to comment.