diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index bd31077..b2c1a6e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -62,7 +62,7 @@ jobs: # Uncomment to re-enable multi-OS testing: # os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest] - python: ["3.10", "3.11", "3.12", "3.13"] + python: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v4 with: @@ -170,7 +170,7 @@ jobs: # Uncomment to re-enable multi-OS testing: # os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest] - python: ["3.10", "3.11", "3.12", "3.13"] + python: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v3 # Checkout repo here is required so pyproject.toml and source code exist. diff --git a/.gitignore b/.gitignore index 203402f..a5c6475 100644 --- a/.gitignore +++ b/.gitignore @@ -190,6 +190,7 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. However, if you prefer, # you could uncomment the following to ignore the entire vscode folder .vscode/ +.continue/ # Ruff stuff: .ruff_cache/ diff --git a/pyproject.toml b/pyproject.toml index f6359bc..47e6ff3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "woffu_client" version = "0.0.0" # This will be replaced by the CI pipeline -requires-python = ">=3.10,<3.14" +requires-python = ">=3.10,<3.15" #43 description = "Woffu API client with access to several endpoints." authors = [{name="Marc PalacĂ­n Marfil", email="marc.palacin.marfil@gmail.com"}] readme = "README.md" @@ -18,7 +18,7 @@ dependencies = [ [project.optional-dependencies] dev = [ "pytest==8.1.1", - "pytest-cov==5.0.0", + "pytest-cov>=6.0.0", "pre-commit==4.3.0" ] diff --git a/src/woffu_client/stdrequests_session.py b/src/woffu_client/stdrequests_session.py index ba96fd8..80205f1 100644 --- a/src/woffu_client/stdrequests_session.py +++ b/src/woffu_client/stdrequests_session.py @@ -300,6 +300,7 @@ def _send_request( ) -> HTTPResponse: """Perform the HTTP request with retries and return HTTPResponse.""" last_exc: Optional[Exception] = None + for attempt in range(retries): try: req = urllib.request.Request( @@ -326,6 +327,7 @@ def _send_request( continue raise last_exc + # This should never be reached due to the logic above raise RuntimeError( "Request failed unexpectedly without raising an exception", ) diff --git a/tests/test_stdrequests_session.py b/tests/test_stdrequests_session.py index 65aa0a5..f3484fd 100644 --- a/tests/test_stdrequests_session.py +++ b/tests/test_stdrequests_session.py @@ -799,27 +799,10 @@ def read(self): finally: self.session.opener.open = original_open - def test_request_defensive_fallback_range_empty(self): + def test_request_defensive_fallback_retries_empty(self): """Test defensive fallback on requests.""" - # Save original range for later restoration - import builtins - - original_range = builtins.range - - # Define a local 'range' that yields nothing - # to simulate empty retry loop - def empty_range(*args, **kwargs): - return iter(()) - - try: - # Override builtins.range locally inside this test - builtins.range = empty_range - - with self.assertRaises(RuntimeError): - self.session.request("GET", "https://example.com") - finally: - # Restore original range - builtins.range = original_range + with self.assertRaises(RuntimeError): + self.session.request("GET", "https://example.com", retries=0) def test_http_error_with_other_codes(self) -> None: """Test HTTPError status codes."""