Skip to content

Commit 1392ae6

Browse files
Merge pull request #301 from OneBusAway/release-please--branches--main--changes--next
release: 1.12.2
2 parents 8962801 + a5c7347 commit 1392ae6

File tree

8 files changed

+90
-32
lines changed

8 files changed

+90
-32
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
- 'integrated/**'
88
- 'stl-preview-head/**'
99
- 'stl-preview-base/**'
10+
pull_request:
11+
branches-ignore:
12+
- 'stl-preview-head/**'
13+
- 'stl-preview-base/**'
1014

1115
jobs:
1216
lint:

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.12.1"
2+
".": "1.12.2"
33
}

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
## 1.12.2 (2025-06-19)
4+
5+
Full Changelog: [v1.12.1...v1.12.2](https://github.com/OneBusAway/python-sdk/compare/v1.12.1...v1.12.2)
6+
7+
### Bug Fixes
8+
9+
* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([355779a](https://github.com/OneBusAway/python-sdk/commit/355779aceef53b58275a4dab5020d414044adbb0))
10+
11+
12+
### Chores
13+
14+
* **ci:** enable for pull requests ([2b9118f](https://github.com/OneBusAway/python-sdk/commit/2b9118f1154e0f8e90c71a1fb37577c63a57c63f))
15+
* **internal:** update conftest.py ([a2b6c3e](https://github.com/OneBusAway/python-sdk/commit/a2b6c3e1d78656155c5eb2f0a1cff69de045909b))
16+
* **readme:** update badges ([dc50499](https://github.com/OneBusAway/python-sdk/commit/dc504994e1f2c2c76e0a46941b97b35a90b0e5c5))
17+
* **tests:** add tests for httpx client instantiation & proxies ([55c4719](https://github.com/OneBusAway/python-sdk/commit/55c4719837747d638cfbb9e79f683189045338ab))
18+
19+
20+
### Documentation
21+
22+
* **client:** fix httpx.Timeout documentation reference ([5e8cb3a](https://github.com/OneBusAway/python-sdk/commit/5e8cb3aa66d4a60f7e96d71cf5bbf2fedeb172ef))
23+
324
## 1.12.1 (2025-06-13)
425

526
Full Changelog: [v1.12.0...v1.12.1](https://github.com/OneBusAway/python-sdk/compare/v1.12.0...v1.12.1)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# OneBusAway SDK Python API library
22

3-
[![PyPI version](https://img.shields.io/pypi/v/onebusaway.svg)](https://pypi.org/project/onebusaway/)
3+
[![PyPI version](<https://img.shields.io/pypi/v/onebusaway.svg?label=pypi%20(stable)>)](https://pypi.org/project/onebusaway/)
44

55

66
The Onebusaway SDK Python library provides convenient access to the Onebusaway SDK REST API from any Python 3.8+
@@ -138,7 +138,7 @@ client.with_options(max_retries=5).current_time.retrieve()
138138
### Timeouts
139139

140140
By default requests time out after 1 minute. You can configure this with a `timeout` option,
141-
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
141+
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
142142

143143
```python
144144
from onebusaway import OnebusawaySDK

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "onebusaway"
3-
version = "1.12.1"
3+
version = "1.12.2"
44
description = "The official Python library for the onebusaway-sdk API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/onebusaway/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "onebusaway"
4-
__version__ = "1.12.1" # x-release-please-version
4+
__version__ = "1.12.2" # x-release-please-version

tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
13
from __future__ import annotations
24

35
import os

tests/test_client.py

Lines changed: 58 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525
from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK, APIResponseValidationError
2626
from onebusaway._types import Omit
2727
from onebusaway._models import BaseModel, FinalRequestOptions
28-
from onebusaway._constants import RAW_RESPONSE_HEADER
2928
from onebusaway._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError
3029
from onebusaway._base_client import (
3130
DEFAULT_TIMEOUT,
3231
HTTPX_DEFAULT_TIMEOUT,
3332
BaseClient,
33+
DefaultHttpxClient,
34+
DefaultAsyncHttpxClient,
3435
make_request_options,
3536
)
3637

@@ -715,30 +716,21 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str
715716

716717
@mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
717718
@pytest.mark.respx(base_url=base_url)
718-
def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
719+
def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, client: OnebusawaySDK) -> None:
719720
respx_mock.get("/api/where/current-time.json").mock(side_effect=httpx.TimeoutException("Test timeout error"))
720721

721722
with pytest.raises(APITimeoutError):
722-
self.client.get(
723-
"/api/where/current-time.json",
724-
cast_to=httpx.Response,
725-
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
726-
)
723+
client.current_time.with_streaming_response.retrieve().__enter__()
727724

728725
assert _get_open_connections(self.client) == 0
729726

730727
@mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
731728
@pytest.mark.respx(base_url=base_url)
732-
def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
729+
def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client: OnebusawaySDK) -> None:
733730
respx_mock.get("/api/where/current-time.json").mock(return_value=httpx.Response(500))
734731

735732
with pytest.raises(APIStatusError):
736-
self.client.get(
737-
"/api/where/current-time.json",
738-
cast_to=httpx.Response,
739-
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
740-
)
741-
733+
client.current_time.with_streaming_response.retrieve().__enter__()
742734
assert _get_open_connections(self.client) == 0
743735

744736
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
@@ -818,6 +810,28 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
818810

819811
assert response.http_request.headers.get("x-stainless-retry-count") == "42"
820812

813+
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
814+
# Test that the proxy environment variables are set correctly
815+
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
816+
817+
client = DefaultHttpxClient()
818+
819+
mounts = tuple(client._mounts.items())
820+
assert len(mounts) == 1
821+
assert mounts[0][0].pattern == "https://"
822+
823+
@pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning")
824+
def test_default_client_creation(self) -> None:
825+
# Ensure that the client can be initialized without any exceptions
826+
DefaultHttpxClient(
827+
verify=True,
828+
cert=None,
829+
trust_env=True,
830+
http1=True,
831+
http2=False,
832+
limits=httpx.Limits(max_connections=100, max_keepalive_connections=20),
833+
)
834+
821835
@pytest.mark.respx(base_url=base_url)
822836
def test_follow_redirects(self, respx_mock: MockRouter) -> None:
823837
# Test that the default follow_redirects=True allows following redirects
@@ -1509,30 +1523,25 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte
15091523

15101524
@mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
15111525
@pytest.mark.respx(base_url=base_url)
1512-
async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
1526+
async def test_retrying_timeout_errors_doesnt_leak(
1527+
self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK
1528+
) -> None:
15131529
respx_mock.get("/api/where/current-time.json").mock(side_effect=httpx.TimeoutException("Test timeout error"))
15141530

15151531
with pytest.raises(APITimeoutError):
1516-
await self.client.get(
1517-
"/api/where/current-time.json",
1518-
cast_to=httpx.Response,
1519-
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
1520-
)
1532+
await async_client.current_time.with_streaming_response.retrieve().__aenter__()
15211533

15221534
assert _get_open_connections(self.client) == 0
15231535

15241536
@mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
15251537
@pytest.mark.respx(base_url=base_url)
1526-
async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
1538+
async def test_retrying_status_errors_doesnt_leak(
1539+
self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK
1540+
) -> None:
15271541
respx_mock.get("/api/where/current-time.json").mock(return_value=httpx.Response(500))
15281542

15291543
with pytest.raises(APIStatusError):
1530-
await self.client.get(
1531-
"/api/where/current-time.json",
1532-
cast_to=httpx.Response,
1533-
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
1534-
)
1535-
1544+
await async_client.current_time.with_streaming_response.retrieve().__aenter__()
15361545
assert _get_open_connections(self.client) == 0
15371546

15381547
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
@@ -1662,6 +1671,28 @@ async def test_main() -> None:
16621671

16631672
time.sleep(0.1)
16641673

1674+
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
1675+
# Test that the proxy environment variables are set correctly
1676+
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1677+
1678+
client = DefaultAsyncHttpxClient()
1679+
1680+
mounts = tuple(client._mounts.items())
1681+
assert len(mounts) == 1
1682+
assert mounts[0][0].pattern == "https://"
1683+
1684+
@pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning")
1685+
async def test_default_client_creation(self) -> None:
1686+
# Ensure that the client can be initialized without any exceptions
1687+
DefaultAsyncHttpxClient(
1688+
verify=True,
1689+
cert=None,
1690+
trust_env=True,
1691+
http1=True,
1692+
http2=False,
1693+
limits=httpx.Limits(max_connections=100, max_keepalive_connections=20),
1694+
)
1695+
16651696
@pytest.mark.respx(base_url=base_url)
16661697
async def test_follow_redirects(self, respx_mock: MockRouter) -> None:
16671698
# Test that the default follow_redirects=True allows following redirects

0 commit comments

Comments
 (0)