Skip to content

Commit bd05515

Browse files
Python: Temporarily skip OpenAI integration tests (#14517)
Disable failing OpenAI integration and sample cases while the CI API key returns HTTP 401. Keep other providers and OpenAPI cross-language coverage enabled. ### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 58ad1a3 commit bd05515

15 files changed

Lines changed: 232 additions & 83 deletions

‎python/tests/integration/agents/chat_completion_agent/test_chat_completion_agent_integration.py‎

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
from semantic_kernel.functions import kernel_function
1616
from tests.integration.agents.agent_test_base import AgentTestBase
1717

18+
openai_api_key_skip = pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401).")
19+
1820

1921
class WeatherPlugin:
2022
"""A sample Mock weather plugin."""
@@ -57,15 +59,25 @@ async def chat_completion_agent(self, request):
5759

5860
# region Simple 'Hello' messages tests
5961

60-
@pytest.mark.parametrize("chat_completion_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
62+
@pytest.mark.parametrize(
63+
"chat_completion_agent",
64+
["azure", pytest.param("openai", marks=openai_api_key_skip)],
65+
indirect=True,
66+
ids=["azure", "openai"],
67+
)
6168
async def test_get_response(self, chat_completion_agent: ChatCompletionAgent, agent_test_base: AgentTestBase):
6269
"""Test get response of the agent."""
6370
response = await agent_test_base.get_response_with_retry(chat_completion_agent, messages="Hello")
6471
assert isinstance(response.message, ChatMessageContent)
6572
assert response.message.role == AuthorRole.ASSISTANT
6673
assert response.message.content is not None
6774

68-
@pytest.mark.parametrize("chat_completion_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
75+
@pytest.mark.parametrize(
76+
"chat_completion_agent",
77+
["azure", pytest.param("openai", marks=openai_api_key_skip)],
78+
indirect=True,
79+
ids=["azure", "openai"],
80+
)
6981
async def test_get_response_with_thread(
7082
self, chat_completion_agent: ChatCompletionAgent, agent_test_base: AgentTestBase
7183
):
@@ -85,7 +97,12 @@ async def test_get_response_with_thread(
8597
assert response.message.content is not None
8698
await thread.delete() if thread else None
8799

88-
@pytest.mark.parametrize("chat_completion_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
100+
@pytest.mark.parametrize(
101+
"chat_completion_agent",
102+
["azure", pytest.param("openai", marks=openai_api_key_skip)],
103+
indirect=True,
104+
ids=["azure", "openai"],
105+
)
89106
async def test_invoke(self, chat_completion_agent: ChatCompletionAgent, agent_test_base: AgentTestBase):
90107
"""Test invoke of the agent."""
91108
responses = await agent_test_base.get_invoke_with_retry(chat_completion_agent, messages="Hello")
@@ -100,7 +117,12 @@ async def test_invoke(self, chat_completion_agent: ChatCompletionAgent, agent_te
100117
assert usage.prompt_tokens > 0
101118
assert usage.completion_tokens > 0
102119

103-
@pytest.mark.parametrize("chat_completion_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
120+
@pytest.mark.parametrize(
121+
"chat_completion_agent",
122+
["azure", pytest.param("openai", marks=openai_api_key_skip)],
123+
indirect=True,
124+
ids=["azure", "openai"],
125+
)
104126
async def test_invoke_with_thread(self, chat_completion_agent: ChatCompletionAgent, agent_test_base: AgentTestBase):
105127
"""Test invoke of the agent with a thread."""
106128
thread = None
@@ -119,7 +141,12 @@ async def test_invoke_with_thread(self, chat_completion_agent: ChatCompletionAge
119141

120142
await thread.delete() if thread else None
121143

122-
@pytest.mark.parametrize("chat_completion_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
144+
@pytest.mark.parametrize(
145+
"chat_completion_agent",
146+
["azure", pytest.param("openai", marks=openai_api_key_skip)],
147+
indirect=True,
148+
ids=["azure", "openai"],
149+
)
123150
async def test_invoke_stream(self, chat_completion_agent: ChatCompletionAgent, agent_test_base: AgentTestBase):
124151
"""Test invoke stream of the agent."""
125152
responses = await agent_test_base.get_invoke_stream_with_retry(chat_completion_agent, messages="Hello")
@@ -134,7 +161,12 @@ async def test_invoke_stream(self, chat_completion_agent: ChatCompletionAgent, a
134161
assert usage.prompt_tokens > 0
135162
assert usage.completion_tokens > 0
136163

137-
@pytest.mark.parametrize("chat_completion_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
164+
@pytest.mark.parametrize(
165+
"chat_completion_agent",
166+
["azure", pytest.param("openai", marks=openai_api_key_skip)],
167+
indirect=True,
168+
ids=["azure", "openai"],
169+
)
138170
async def test_invoke_stream_with_thread(
139171
self, chat_completion_agent: ChatCompletionAgent, agent_test_base: AgentTestBase
140172
):
@@ -163,7 +195,7 @@ async def test_invoke_stream_with_thread(
163195
"chat_completion_agent",
164196
[
165197
("azure", {"enable_kernel_function": True}),
166-
("openai", {"enable_kernel_function": True}),
198+
pytest.param(("openai", {"enable_kernel_function": True}), marks=openai_api_key_skip),
167199
],
168200
indirect=["chat_completion_agent"],
169201
ids=["azure-function-calling", "openai-function-calling"],
@@ -185,7 +217,7 @@ async def test_function_calling_get_response(
185217
"chat_completion_agent",
186218
[
187219
("azure", {"enable_kernel_function": True}),
188-
("openai", {"enable_kernel_function": True}),
220+
pytest.param(("openai", {"enable_kernel_function": True}), marks=openai_api_key_skip),
189221
],
190222
indirect=["chat_completion_agent"],
191223
ids=["azure-function-calling", "openai-function-calling"],
@@ -209,7 +241,7 @@ async def test_function_calling_invoke(
209241
"chat_completion_agent",
210242
[
211243
("azure", {"enable_kernel_function": True}),
212-
("openai", {"enable_kernel_function": True}),
244+
pytest.param(("openai", {"enable_kernel_function": True}), marks=openai_api_key_skip),
213245
],
214246
indirect=["chat_completion_agent"],
215247
ids=["azure-function-calling", "openai-function-calling"],
@@ -240,7 +272,10 @@ async def test_function_calling_stream(
240272
("azure", {"enable_kernel_function": True}),
241273
pytest.param(
242274
("openai", {"enable_kernel_function": True}),
243-
marks=pytest.mark.xfail(reason="OpenAI service raise error for downloading image from URL"),
275+
marks=[
276+
pytest.mark.xfail(reason="OpenAI service raise error for downloading image from URL"),
277+
openai_api_key_skip,
278+
],
244279
),
245280
],
246281
indirect=["chat_completion_agent"],

‎python/tests/integration/agents/openai_responses_agent/test_openai_responses_agent_integration.py‎

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
from semantic_kernel.functions import kernel_function
1616
from tests.integration.agents.agent_test_base import AgentTestBase
1717

18+
openai_api_key_skip = pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401).")
19+
1820

1921
class WeatherPlugin:
2022
"""A sample Mock weather plugin."""
@@ -99,7 +101,12 @@ async def responses_agent(self, request):
99101

100102
# region Simple 'Hello' messages tests
101103

102-
@pytest.mark.parametrize("responses_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
104+
@pytest.mark.parametrize(
105+
"responses_agent",
106+
["azure", pytest.param("openai", marks=openai_api_key_skip)],
107+
indirect=True,
108+
ids=["azure", "openai"],
109+
)
103110
async def test_get_response(self, responses_agent: OpenAIResponsesAgent, agent_test_base: AgentTestBase):
104111
"""Test get response of the agent."""
105112
response = await agent_test_base.get_response_with_retry(responses_agent, messages="Hello")
@@ -108,7 +115,12 @@ async def test_get_response(self, responses_agent: OpenAIResponsesAgent, agent_t
108115
assert response.message.content is not None
109116
assert "thread_id" in response.message.metadata
110117

111-
@pytest.mark.parametrize("responses_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
118+
@pytest.mark.parametrize(
119+
"responses_agent",
120+
["azure", pytest.param("openai", marks=openai_api_key_skip)],
121+
indirect=True,
122+
ids=["azure", "openai"],
123+
)
112124
async def test_get_response_with_thread(
113125
self, responses_agent: OpenAIResponsesAgent, agent_test_base: AgentTestBase
114126
):
@@ -127,15 +139,25 @@ async def test_get_response_with_thread(
127139

128140
await thread.delete() if thread else None
129141

130-
@pytest.mark.parametrize("responses_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
142+
@pytest.mark.parametrize(
143+
"responses_agent",
144+
["azure", pytest.param("openai", marks=openai_api_key_skip)],
145+
indirect=True,
146+
ids=["azure", "openai"],
147+
)
131148
async def test_invoke(self, responses_agent: OpenAIResponsesAgent, agent_test_base: AgentTestBase):
132149
"""Test invoke of the agent."""
133150
async for response in responses_agent.invoke(messages="Hello"):
134151
assert isinstance(response.message, ChatMessageContent)
135152
assert response.message.role == AuthorRole.ASSISTANT
136153
assert response.message.content is not None
137154

138-
@pytest.mark.parametrize("responses_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
155+
@pytest.mark.parametrize(
156+
"responses_agent",
157+
["azure", pytest.param("openai", marks=openai_api_key_skip)],
158+
indirect=True,
159+
ids=["azure", "openai"],
160+
)
139161
async def test_invoke_with_thread(self, responses_agent: OpenAIResponsesAgent, agent_test_base: AgentTestBase):
140162
"""Test invoke of the agent with a thread."""
141163
thread = None
@@ -154,7 +176,12 @@ async def test_invoke_with_thread(self, responses_agent: OpenAIResponsesAgent, a
154176

155177
await thread.delete() if thread else None
156178

157-
@pytest.mark.parametrize("responses_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
179+
@pytest.mark.parametrize(
180+
"responses_agent",
181+
["azure", pytest.param("openai", marks=openai_api_key_skip)],
182+
indirect=True,
183+
ids=["azure", "openai"],
184+
)
158185
async def test_invoke_stream(self, responses_agent: OpenAIResponsesAgent, agent_test_base: AgentTestBase):
159186
"""Test invoke stream of the agent."""
160187
responses = await agent_test_base.get_invoke_stream_with_retry(responses_agent, messages="Hello")
@@ -164,7 +191,12 @@ async def test_invoke_stream(self, responses_agent: OpenAIResponsesAgent, agent_
164191
assert response.message.role == AuthorRole.ASSISTANT
165192
assert response.message.content is not None
166193

167-
@pytest.mark.parametrize("responses_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
194+
@pytest.mark.parametrize(
195+
"responses_agent",
196+
["azure", pytest.param("openai", marks=openai_api_key_skip)],
197+
indirect=True,
198+
ids=["azure", "openai"],
199+
)
168200
async def test_invoke_stream_with_thread(
169201
self, responses_agent: OpenAIResponsesAgent, agent_test_base: AgentTestBase
170202
):
@@ -193,7 +225,7 @@ async def test_invoke_stream_with_thread(
193225
"responses_agent",
194226
[
195227
# Azure OpenAI Responses API doesn't yet support the web search tool
196-
("openai", {"enable_web_search": True}),
228+
pytest.param(("openai", {"enable_web_search": True}), marks=openai_api_key_skip),
197229
],
198230
indirect=["responses_agent"],
199231
ids=["openai-web-search-get-response"],
@@ -215,7 +247,7 @@ async def test_web_search_get_response(self, responses_agent: OpenAIResponsesAge
215247
"responses_agent",
216248
[
217249
("azure", {"enable_file_search": True}),
218-
("openai", {"enable_file_search": True}),
250+
pytest.param(("openai", {"enable_file_search": True}), marks=openai_api_key_skip),
219251
],
220252
indirect=["responses_agent"],
221253
ids=["azure-file-search-get-response", "openai-file-search-get-response"],
@@ -234,7 +266,7 @@ async def test_file_search_get_response(
234266
"responses_agent",
235267
[
236268
("azure", {"enable_file_search": True}),
237-
("openai", {"enable_file_search": True}),
269+
pytest.param(("openai", {"enable_file_search": True}), marks=openai_api_key_skip),
238270
],
239271
indirect=["responses_agent"],
240272
ids=["azure-file-search-invoke", "openai-file-search-invoke"],
@@ -253,7 +285,7 @@ async def test_file_search_invoke(self, responses_agent: OpenAIResponsesAgent, a
253285
"responses_agent",
254286
[
255287
("azure", {"enable_file_search": True}),
256-
("openai", {"enable_file_search": True}),
288+
pytest.param(("openai", {"enable_file_search": True}), marks=openai_api_key_skip),
257289
],
258290
indirect=["responses_agent"],
259291
ids=["azure-file-search-invoke-stream", "openai-file-search-invoke-stream"],
@@ -278,7 +310,7 @@ async def test_file_search_invoke_stream(
278310
"responses_agent",
279311
[
280312
("azure", {"enable_kernel_function": True}),
281-
("openai", {"enable_kernel_function": True}),
313+
pytest.param(("openai", {"enable_kernel_function": True}), marks=openai_api_key_skip),
282314
],
283315
indirect=["responses_agent"],
284316
ids=["azure-function-calling-get-response", "openai-function-calling-get-response"],
@@ -300,7 +332,7 @@ async def test_function_calling_get_response(
300332
"responses_agent",
301333
[
302334
("azure", {"enable_kernel_function": True}),
303-
("openai", {"enable_kernel_function": True}),
335+
pytest.param(("openai", {"enable_kernel_function": True}), marks=openai_api_key_skip),
304336
],
305337
indirect=["responses_agent"],
306338
ids=["azure-function-calling-invoke", "openai-function-calling-invoke"],
@@ -322,7 +354,7 @@ async def test_function_calling_invoke(self, responses_agent: OpenAIResponsesAge
322354
"responses_agent",
323355
[
324356
("azure", {"enable_kernel_function": True}),
325-
("openai", {"enable_kernel_function": True}),
357+
pytest.param(("openai", {"enable_kernel_function": True}), marks=openai_api_key_skip),
326358
],
327359
indirect=["responses_agent"],
328360
ids=["azure-function-calling-invoke-stream", "openai-function-calling-invoke-stream"],
@@ -349,7 +381,7 @@ async def test_function_calling_stream(self, responses_agent: OpenAIResponsesAge
349381
"responses_agent",
350382
[
351383
("azure", {"enable_structured_outputs": True}),
352-
("openai", {"enable_structured_outputs": True}),
384+
pytest.param(("openai", {"enable_structured_outputs": True}), marks=openai_api_key_skip),
353385
],
354386
indirect=["responses_agent"],
355387
ids=["azure-structured-outputs-get-response", "openai-structured-outputs-get-response"],
@@ -371,7 +403,7 @@ async def test_structured_outputs_get_response(
371403
"responses_agent",
372404
[
373405
("azure", {"enable_structured_outputs": True}),
374-
("openai", {"enable_structured_outputs": True}),
406+
pytest.param(("openai", {"enable_structured_outputs": True}), marks=openai_api_key_skip),
375407
],
376408
indirect=["responses_agent"],
377409
ids=["azure-structured-outputs-invoke", "openai-structured-outputs-invoke"],
@@ -395,7 +427,7 @@ async def test_structured_outputs_invoke(
395427
"responses_agent",
396428
[
397429
("azure", {"enable_structured_outputs": True}),
398-
("openai", {"enable_structured_outputs": True}),
430+
pytest.param(("openai", {"enable_structured_outputs": True}), marks=openai_api_key_skip),
399431
],
400432
indirect=["responses_agent"],
401433
ids=["azure-structured-outputs-invoke-stream", "openai-structured-outputs-invoke-stream"],

‎python/tests/integration/audio_to_text/test_audio_to_text.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"openai",
1616
AudioContent.from_audio_file(os.path.join(os.path.dirname(__file__), "../../", "assets/sample_audio.mp3")),
1717
["hi", "how", "are", "you", "doing"],
18+
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
1819
id="openai",
1920
),
2021
pytest.param(

‎python/tests/integration/completions/test_chat_completion_with_function_calling.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class FunctionChoiceTestTypes(str, Enum):
7575
]
7676
],
7777
{"test_type": FunctionChoiceTestTypes.AUTO},
78+
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
7879
id="openai_tool_call_auto",
7980
),
8081
pytest.param(
@@ -97,6 +98,7 @@ class FunctionChoiceTestTypes(str, Enum):
9798
]
9899
],
99100
{"test_type": FunctionChoiceTestTypes.NON_AUTO},
101+
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
100102
id="openai_tool_call_non_auto",
101103
),
102104
pytest.param(
@@ -123,6 +125,7 @@ class FunctionChoiceTestTypes(str, Enum):
123125
],
124126
],
125127
{"test_type": FunctionChoiceTestTypes.FLOW},
128+
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
126129
id="openai_tool_call_flow",
127130
),
128131
pytest.param(
@@ -141,6 +144,7 @@ class FunctionChoiceTestTypes(str, Enum):
141144
]
142145
],
143146
{"test_type": FunctionChoiceTestTypes.AUTO},
147+
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
144148
id="openai_tool_call_auto_complex_return_type",
145149
),
146150
# endregion

‎python/tests/integration/completions/test_chat_completion_with_image_input_text_output.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
ChatMessageContent(role=AuthorRole.USER, items=[TextContent(text="Where was it made?")]),
5050
],
5151
{},
52+
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
5253
id="openai_image_input_uri",
5354
),
5455
pytest.param(
@@ -67,6 +68,7 @@
6768
ChatMessageContent(role=AuthorRole.USER, items=[TextContent(text="Where was it made?")]),
6869
],
6970
{},
71+
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
7072
id="openai_image_input_file",
7173
),
7274
pytest.param(

‎python/tests/integration/completions/test_chat_completions.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class Reasoning(KernelBaseModel):
4949
ChatMessageContent(role=AuthorRole.USER, items=[TextContent(text="How are you today?")]),
5050
],
5151
{},
52+
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
5253
id="openai_text_input",
5354
),
5455
pytest.param(
@@ -59,6 +60,7 @@ class Reasoning(KernelBaseModel):
5960
ChatMessageContent(role=AuthorRole.USER, items=[TextContent(text="How are you today?")]),
6061
],
6162
{},
63+
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
6264
id="openai_json_schema_response_format",
6365
),
6466
# endregion

0 commit comments

Comments
 (0)