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

Change contrib-tests.yml tests to use --skip-openai #1132

Merged
merged 6 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
25 changes: 10 additions & 15 deletions .github/workflows/contrib-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,14 @@ jobs:
- name: Install packages and dependencies for RetrieveChat
run: |
pip install -e .[retrievechat]
pip uninstall -y openai
- name: Test RetrieveChat
run: |
pytest test/test_retrieve_utils.py test/agentchat/contrib/test_retrievechat.py test/agentchat/contrib/test_qdrant_retrievechat.py
pytest test/test_retrieve_utils.py test/agentchat/contrib/test_retrievechat.py test/agentchat/contrib/test_qdrant_retrievechat.py --skip-openai
- name: Coverage
if: matrix.python-version == '3.10'
run: |
pip install coverage>=5.3
coverage run -a -m pytest test/test_retrieve_utils.py test/agentchat/contrib
coverage run -a -m pytest test/test_retrieve_utils.py test/agentchat/contrib/test_retrievechat.py test/agentchat/contrib/test_qdrant_retrievechat.py --skip-openai
coverage xml
- name: Upload coverage to Codecov
if: matrix.python-version == '3.10'
Expand Down Expand Up @@ -82,16 +81,15 @@ jobs:
- name: Install packages and dependencies for Compression
run: |
pip install -e .
pip uninstall -y openai
- name: Test Compression
if: matrix.python-version != '3.10' # diversify the python versions
run: |
pytest test/agentchat/contrib/test_compressible_agent.py
pytest test/agentchat/contrib/test_compressible_agent.py --skip-openai
- name: Coverage
if: matrix.python-version == '3.10'
run: |
pip install coverage>=5.3
coverage run -a -m pytest test/agentchat/contrib/test_compressible_agent.py
coverage run -a -m pytest test/agentchat/contrib/test_compressible_agent.py --skip-openai
coverage xml
- name: Upload coverage to Codecov
if: matrix.python-version == '3.10'
Expand Down Expand Up @@ -120,16 +118,15 @@ jobs:
- name: Install packages and dependencies for GPTAssistantAgent
run: |
pip install -e .
pip uninstall -y openai
- name: Test GPTAssistantAgent
if: matrix.python-version != '3.11' # diversify the python versions
run: |
pytest test/agentchat/contrib/test_gpt_assistant.py
pytest test/agentchat/contrib/test_gpt_assistant.py --skip-openai
- name: Coverage
if: matrix.python-version == '3.11'
run: |
pip install coverage>=5.3
coverage run -a -m pytest test/agentchat/contrib/test_gpt_assistant.py
coverage run -a -m pytest test/agentchat/contrib/test_gpt_assistant.py --skip-openai
coverage xml
- name: Upload coverage to Codecov
if: matrix.python-version == '3.11'
Expand Down Expand Up @@ -158,16 +155,15 @@ jobs:
- name: Install packages and dependencies for TeachableAgent
run: |
pip install -e .[teachable]
pip uninstall -y openai
- name: Test TeachableAgent
if: matrix.python-version != '3.9' # diversify the python versions
run: |
pytest test/agentchat/contrib/test_teachable_agent.py
pytest test/agentchat/contrib/test_teachable_agent.py --skip-openai
- name: Coverage
if: matrix.python-version == '3.9'
run: |
pip install coverage>=5.3
coverage run -a -m pytest test/agentchat/contrib/test_teachable_agent.py
coverage run -a -m pytest test/agentchat/contrib/test_teachable_agent.py --skip-openai
coverage xml
- name: Upload coverage to Codecov
if: matrix.python-version == '3.9'
Expand Down Expand Up @@ -196,15 +192,14 @@ jobs:
- name: Install packages and dependencies for LMM
run: |
pip install -e .[lmm]
pip uninstall -y openai
- name: Test LMM and LLaVA
run: |
pytest test/agentchat/contrib/test_img_utils.py test/agentchat/contrib/test_lmm.py test/agentchat/contrib/test_llava.py
pytest test/agentchat/contrib/test_img_utils.py test/agentchat/contrib/test_lmm.py test/agentchat/contrib/test_llava.py --skip-openai
- name: Coverage
if: matrix.python-version == '3.10'
run: |
pip install coverage>=5.3
coverage run -a -m pytest test/agentchat/contrib/test_img_utils.py test/agentchat/contrib/test_lmm.py test/agentchat/contrib/test_llava.py
coverage run -a -m pytest test/agentchat/contrib/test_img_utils.py test/agentchat/contrib/test_lmm.py test/agentchat/contrib/test_llava.py --skip-openai
coverage xml
- name: Upload coverage to Codecov
if: matrix.python-version == '3.10'
Expand Down
11 changes: 6 additions & 5 deletions test/agentchat/contrib/test_qdrant_retrievechat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pytest
from autogen.agentchat.contrib.retrieve_assistant_agent import RetrieveAssistantAgent
from autogen import config_list_from_json
from conftest import skip_openai
sonichi marked this conversation as resolved.
Show resolved Hide resolved

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST # noqa: E402
Expand All @@ -22,17 +23,17 @@

try:
import openai

OPENAI_INSTALLED = True
except ImportError:
OPENAI_INSTALLED = False
skip = True
else:
skip = False or skip_openai

test_dir = os.path.join(os.path.dirname(__file__), "../..", "test_files")


@pytest.mark.skipif(
sys.platform in ["darwin", "win32"] or not QDRANT_INSTALLED or not OPENAI_INSTALLED,
reason="do not run on MacOS or windows or dependency is not installed",
sys.platform in ["darwin", "win32"] or not QDRANT_INSTALLED or skip,
reason="do not run on MacOS or windows OR dependency is not installed OR requested to skip",
)
def test_retrievechat():
conversations = {}
Expand Down
15 changes: 8 additions & 7 deletions test/agentchat/contrib/test_retrievechat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import sys
import autogen
from conftest import skip_openai
sonichi marked this conversation as resolved.
Show resolved Hide resolved

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST # noqa: E402
Expand All @@ -16,15 +17,15 @@
)
import chromadb
from chromadb.utils import embedding_functions as ef

skip_test = False
except ImportError:
skip_test = True
skip = True
else:
skip = False or skip_openai


@pytest.mark.skipif(
sys.platform in ["darwin", "win32"] or skip_test,
reason="do not run on MacOS or windows or dependency is not installed",
sys.platform in ["darwin", "win32"] or skip,
reason="do not run on MacOS or windows OR dependency is not installed OR requested to skip",
)
def test_retrievechat():
conversations = {}
Expand Down Expand Up @@ -69,8 +70,8 @@ def test_retrievechat():


@pytest.mark.skipif(
sys.platform in ["darwin", "win32"] or skip_test,
reason="do not run on MacOS or windows or dependency is not installed",
sys.platform in ["darwin", "win32"] or skip,
reason="do not run on MacOS or windows OR dependency is not installed OR requested to skip",
)
def test_retrieve_config(caplog):
# test warning message when no docs_path is provided
Expand Down
Loading