Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let run tests directly via python test_xyz.py, fix for conftest import via sys.path.append #1144

Merged
merged 3 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion notebook/oai_client_cost.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
4 changes: 3 additions & 1 deletion test/agentchat/contrib/test_agent_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from packaging.requirements import Requirement
from autogen.agentchat.contrib.agent_builder import AgentBuilder
from autogen import UserProxyAgent
from conftest import skip_openai

sys.path.append(os.path.join(os.path.dirname(__file__), "../.."))
from conftest import skip_openai # noqa: E402

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST # noqa: E402
Expand Down
5 changes: 3 additions & 2 deletions test/agentchat/contrib/test_compressible_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
import sys
import autogen
import os
from conftest import skip_openai
from autogen.agentchat.contrib.compressible_agent import CompressibleAgent

sys.path.append(os.path.join(os.path.dirname(__file__), "../.."))
from conftest import skip_openai # noqa: E402

here = os.path.abspath(os.path.dirname(__file__))

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from test_assistant_agent import OAI_CONFIG_LIST, KEY_LOC # noqa: E402

try:
import openai

except ImportError:
skip = True
else:
Expand Down
4 changes: 3 additions & 1 deletion test/agentchat/contrib/test_gpt_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import sys
import autogen
from autogen import OpenAIWrapper
from conftest import skip_openai

sys.path.append(os.path.join(os.path.dirname(__file__), "../.."))
from conftest import skip_openai # noqa: E402

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST # noqa: E402
Expand Down
4 changes: 3 additions & 1 deletion test/agentchat/contrib/test_teachable_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import os
import sys
from autogen import ConversableAgent, config_list_from_json
from conftest import skip_openai

sys.path.append(os.path.join(os.path.dirname(__file__), "../.."))
from conftest import skip_openai # noqa: E402

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from test_assistant_agent import OAI_CONFIG_LIST, KEY_LOC # noqa: E402
Expand Down
4 changes: 3 additions & 1 deletion test/agentchat/test_assistant_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
import sys
import pytest
import autogen
from conftest import skip_openai
from autogen.agentchat import AssistantAgent, UserProxyAgent

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from conftest import skip_openai # noqa: E402

try:
from openai import OpenAI
except ImportError:
Expand Down
6 changes: 5 additions & 1 deletion test/agentchat/test_async.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import pytest
import asyncio
import autogen
from conftest import skip_openai
from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST
import sys
import os

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from conftest import skip_openai # noqa: E402

try:
from openai import OpenAI
Expand Down
6 changes: 5 additions & 1 deletion test/agentchat/test_async_get_human_input.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import asyncio
import autogen
import pytest
from conftest import skip_openai
from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST
import sys
import os

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from conftest import skip_openai # noqa: E402

try:
from openai import OpenAI
Expand Down
5 changes: 4 additions & 1 deletion test/agentchat/test_function_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
import asyncio
import json
import autogen
from conftest import skip_openai
from autogen.math_utils import eval_math_responses
from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST
import sys
import os

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from conftest import skip_openai # noqa: E402

try:
from openai import OpenAI
Expand Down
5 changes: 4 additions & 1 deletion test/agentchat/test_function_call_groupchat.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import autogen
import pytest
import sys
from conftest import skip_openai
import os
from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from conftest import skip_openai # noqa: E402

try:
from openai import OpenAI
except ImportError:
Expand Down
5 changes: 4 additions & 1 deletion test/agentchat/test_math_user_proxy_agent.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import pytest
import sys
import os
import autogen
from autogen.agentchat.contrib.math_user_proxy_agent import (
MathUserProxyAgent,
_remove_print,
_add_print_to_last_line,
)
from conftest import skip_openai
from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from conftest import skip_openai # noqa: E402

try:
from openai import OpenAI
except ImportError:
Expand Down
6 changes: 5 additions & 1 deletion test/oai/test_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import pytest
from autogen import OpenAIWrapper, config_list_from_json, config_list_openai_aoai
from conftest import skip_openai
import sys
import os

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from conftest import skip_openai # noqa: E402

TOOL_ENABLED = False
try:
Expand Down
6 changes: 5 additions & 1 deletion test/oai/test_client_stream.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import pytest
from autogen import OpenAIWrapper, config_list_from_json, config_list_openai_aoai
from conftest import skip_openai
import sys
import os

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from conftest import skip_openai # noqa: E402

try:
from openai import OpenAI
Expand Down
Loading