Skip to content

Commit cac724a

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
chore(internal): test updates (#74)
1 parent e17fb03 commit cac724a

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/runloop_api_client/_utils/_reflection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def assert_signatures_in_sync(
3434

3535
if custom_param.annotation != source_param.annotation:
3636
errors.append(
37-
f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(source_param.annotation)}"
37+
f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(custom_param.annotation)}"
3838
)
3939
continue
4040

tests/test_client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from pydantic import ValidationError
1818

1919
from runloop_api_client import Runloop, AsyncRunloop, APIResponseValidationError
20+
from runloop_api_client._types import Omit
2021
from runloop_api_client._models import BaseModel, FinalRequestOptions
2122
from runloop_api_client._constants import RAW_RESPONSE_HEADER
2223
from runloop_api_client._exceptions import RunloopError, APIStatusError, APITimeoutError, APIResponseValidationError
@@ -340,7 +341,8 @@ def test_validate_headers(self) -> None:
340341
assert request.headers.get("Authorization") == f"Bearer {bearer_token}"
341342

342343
with pytest.raises(RunloopError):
343-
client2 = Runloop(base_url=base_url, bearer_token=None, _strict_response_validation=True)
344+
with update_env(**{"RUNLOOP_API_KEY": Omit()}):
345+
client2 = Runloop(base_url=base_url, bearer_token=None, _strict_response_validation=True)
344346
_ = client2
345347

346348
def test_default_query_option(self) -> None:
@@ -1072,7 +1074,8 @@ def test_validate_headers(self) -> None:
10721074
assert request.headers.get("Authorization") == f"Bearer {bearer_token}"
10731075

10741076
with pytest.raises(RunloopError):
1075-
client2 = AsyncRunloop(base_url=base_url, bearer_token=None, _strict_response_validation=True)
1077+
with update_env(**{"RUNLOOP_API_KEY": Omit()}):
1078+
client2 = AsyncRunloop(base_url=base_url, bearer_token=None, _strict_response_validation=True)
10761079
_ = client2
10771080

10781081
def test_default_query_option(self) -> None:

tests/utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from datetime import date, datetime
99
from typing_extensions import Literal, get_args, get_origin, assert_type
1010

11-
from runloop_api_client._types import NoneType
11+
from runloop_api_client._types import Omit, NoneType
1212
from runloop_api_client._utils import (
1313
is_dict,
1414
is_list,
@@ -139,11 +139,15 @@ def _assert_list_type(type_: type[object], value: object) -> None:
139139

140140

141141
@contextlib.contextmanager
142-
def update_env(**new_env: str) -> Iterator[None]:
142+
def update_env(**new_env: str | Omit) -> Iterator[None]:
143143
old = os.environ.copy()
144144

145145
try:
146-
os.environ.update(new_env)
146+
for name, value in new_env.items():
147+
if isinstance(value, Omit):
148+
os.environ.pop(name, None)
149+
else:
150+
os.environ[name] = value
147151

148152
yield None
149153
finally:

0 commit comments

Comments
 (0)