File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 25
25
from pydantic_ai .result import Usage
26
26
from pydantic_ai .settings import ModelSettings
27
27
28
- from ..conftest import IsNow , try_import
28
+ from ..conftest import IsNow , TestEnv , try_import
29
29
from .mock_async_stream import MockAsyncStream
30
30
31
31
with try_import () as imports_successful :
@@ -70,7 +70,8 @@ def test_init_with_non_openai_model():
70
70
m .name ()
71
71
72
72
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' )
74
75
with pytest .raises (
75
76
OpenAIError ,
76
77
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$' ,
You can’t perform that action at this time.
0 commit comments