Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
]

Expand Down
2 changes: 2 additions & 0 deletions src/woffu_client/stdrequests_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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",
)
Expand Down
23 changes: 3 additions & 20 deletions tests/test_stdrequests_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down