3
3
import sys
4
4
import autogen
5
5
from autogen import OpenAIWrapper
6
+ from conftest import skip_openai
6
7
7
8
sys .path .append (os .path .join (os .path .dirname (__file__ ), ".." ))
8
9
from test_assistant_agent import KEY_LOC , OAI_CONFIG_LIST # noqa: E402
11
12
import openai
12
13
from autogen .agentchat .contrib .gpt_assistant_agent import GPTAssistantAgent
13
14
from autogen .oai .openai_utils import retrieve_assistants_by_name
14
-
15
- skip_test = False
16
15
except ImportError :
17
- skip_test = True
16
+ skip = True
17
+ else :
18
+ skip = False or skip_openai
18
19
19
20
config_list = autogen .config_list_from_json (
20
21
OAI_CONFIG_LIST , file_location = KEY_LOC , filter_dict = {"api_type" : ["openai" ]}
@@ -26,8 +27,8 @@ def ask_ossinsight(question):
26
27
27
28
28
29
@pytest .mark .skipif (
29
- sys .platform in ["darwin" , "win32" ] or skip_test ,
30
- reason = "do not run on MacOS or windows or dependency is not installed" ,
30
+ sys .platform in ["darwin" , "win32" ] or skip ,
31
+ reason = "do not run on MacOS or windows OR dependency is not installed OR requested to skip " ,
31
32
)
32
33
def test_gpt_assistant_chat ():
33
34
ossinsight_api_schema = {
@@ -73,8 +74,8 @@ def test_gpt_assistant_chat():
73
74
74
75
75
76
@pytest .mark .skipif (
76
- sys .platform in ["darwin" , "win32" ] or skip_test ,
77
- reason = "do not run on MacOS or windows or dependency is not installed" ,
77
+ sys .platform in ["darwin" , "win32" ] or skip ,
78
+ reason = "do not run on MacOS or windows OR dependency is not installed OR requested to skip " ,
78
79
)
79
80
def test_get_assistant_instructions ():
80
81
"""
@@ -97,8 +98,8 @@ def test_get_assistant_instructions():
97
98
98
99
99
100
@pytest .mark .skipif (
100
- sys .platform in ["darwin" , "win32" ] or skip_test ,
101
- reason = "do not run on MacOS or windows or dependency is not installed" ,
101
+ sys .platform in ["darwin" , "win32" ] or skip ,
102
+ reason = "do not run on MacOS or windows OR dependency is not installed OR requested to skip " ,
102
103
)
103
104
def test_gpt_assistant_instructions_overwrite ():
104
105
"""
@@ -142,8 +143,8 @@ def test_gpt_assistant_instructions_overwrite():
142
143
143
144
144
145
@pytest .mark .skipif (
145
- sys .platform in ["darwin" , "win32" ] or skip_test ,
146
- reason = "do not run on MacOS or windows or dependency is not installed" ,
146
+ sys .platform in ["darwin" , "win32" ] or skip ,
147
+ reason = "do not run on MacOS or windows OR dependency is not installed OR requested to skip " ,
147
148
)
148
149
def test_gpt_assistant_existing_no_instructions ():
149
150
"""
@@ -178,8 +179,8 @@ def test_gpt_assistant_existing_no_instructions():
178
179
179
180
180
181
@pytest .mark .skipif (
181
- sys .platform in ["darwin" , "win32" ] or skip_test ,
182
- reason = "do not run on MacOS or windows or dependency is not installed" ,
182
+ sys .platform in ["darwin" , "win32" ] or skip ,
183
+ reason = "do not run on MacOS or windows OR dependency is not installed OR requested to skip " ,
183
184
)
184
185
def test_get_assistant_files ():
185
186
"""
@@ -212,8 +213,8 @@ def test_get_assistant_files():
212
213
213
214
214
215
@pytest .mark .skipif (
215
- sys .platform in ["darwin" , "win32" ] or skip_test ,
216
- reason = "do not run on MacOS or windows or dependency is not installed" ,
216
+ sys .platform in ["darwin" , "win32" ] or skip ,
217
+ reason = "do not run on MacOS or windows OR dependency is not installed OR requested to skip " ,
217
218
)
218
219
def test_assistant_retrieval ():
219
220
"""
@@ -283,8 +284,8 @@ def test_assistant_retrieval():
283
284
284
285
285
286
@pytest .mark .skipif (
286
- sys .platform in ["darwin" , "win32" ] or skip_test ,
287
- reason = "do not run on MacOS or windows or dependency is not installed" ,
287
+ sys .platform in ["darwin" , "win32" ] or skip ,
288
+ reason = "do not run on MacOS or windows OR dependency is not installed OR requested to skip " ,
288
289
)
289
290
def test_assistant_mismatch_retrieval ():
290
291
"""Test function to check if the GPTAssistantAgent can filter out the mismatch assistant"""
0 commit comments