Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit a3fda4a

Browse files
committed
test: add header test and update timeout test
1 parent f540e37 commit a3fda4a

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ coveralls = "^3.3.0"
2929
[tool.pytest.ini_options]
3030
asyncio_mode = "auto"
3131
addopts = "tests"
32+
filterwarnings = [
33+
"ignore::DeprecationWarning", # ignore deprecation warnings globally
34+
]
3235

3336
[build-system]
3437
requires = ["poetry-core>=1.0.0"]

pytest.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/_async/test_function_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,22 +201,24 @@ async def test_invoke_with_json_body(client: AsyncFunctionsClient):
201201

202202
async def test_init_with_httpx_client():
203203
# Create a custom httpx client with specific options
204+
headers = {"x-user-agent": "my-app/0.0.1"}
204205
custom_client = AsyncClient(
205-
timeout=Timeout(30), follow_redirects=True, max_redirects=5
206+
timeout=Timeout(30), follow_redirects=True, max_redirects=5, headers=headers
206207
)
207208

208209
# Initialize the functions client with the custom httpx client
209210
client = AsyncFunctionsClient(
210211
url="https://example.com",
211212
headers={"Authorization": "Bearer token"},
212-
timeout=30,
213+
timeout=10,
213214
http_client=custom_client,
214215
)
215216

216217
# Verify the custom client options are preserved
217218
assert client._client.timeout == Timeout(30)
218219
assert client._client.follow_redirects is True
219220
assert client._client.max_redirects == 5
221+
assert client._client.headers.get("x-user-agent") == "my-app/0.0.1"
220222

221223
# Verify the client is properly configured with our custom client
222224
assert client._client is custom_client

tests/_sync/test_function_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,22 +185,24 @@ def test_invoke_with_json_body(client: SyncFunctionsClient):
185185

186186
def test_init_with_httpx_client():
187187
# Create a custom httpx client with specific options
188+
headers = {"x-user-agent": "my-app/0.0.1"}
188189
custom_client = SyncClient(
189-
timeout=Timeout(30), follow_redirects=True, max_redirects=5
190+
timeout=Timeout(30), follow_redirects=True, max_redirects=5, headers=headers
190191
)
191192

192193
# Initialize the functions client with the custom httpx client
193194
client = SyncFunctionsClient(
194195
url="https://example.com",
195196
headers={"Authorization": "Bearer token"},
196-
timeout=30,
197+
timeout=10,
197198
http_client=custom_client,
198199
)
199200

200201
# Verify the custom client options are preserved
201202
assert client._client.timeout == Timeout(30)
202203
assert client._client.follow_redirects is True
203204
assert client._client.max_redirects == 5
205+
assert client._client.headers.get("x-user-agent") == "my-app/0.0.1"
204206

205207
# Verify the client is properly configured with our custom client
206208
assert client._client is custom_client

0 commit comments

Comments
 (0)