Skip to content

Commit b6dd4b7

Browse files
authored
fix OpenAI env var tests following (#855)
1 parent 7766b68 commit b6dd4b7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/models/test_openai.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from pydantic_ai.result import Usage
2626
from pydantic_ai.settings import ModelSettings
2727

28-
from ..conftest import IsNow, try_import
28+
from ..conftest import IsNow, TestEnv, try_import
2929
from .mock_async_stream import MockAsyncStream
3030

3131
with try_import() as imports_successful:
@@ -70,7 +70,8 @@ def test_init_with_non_openai_model():
7070
m.name()
7171

7272

73-
def test_init_of_openai_without_api_key_raises_error():
73+
def test_init_of_openai_without_api_key_raises_error(env: TestEnv):
74+
env.remove('OPENAI_API_KEY')
7475
with pytest.raises(
7576
OpenAIError,
7677
match='^The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable$',

0 commit comments

Comments
 (0)