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

Streamline Testing with pytest-cov and pytest Defaults #2490

Merged
merged 39 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c4bf81b
done
WaelKarkoub Apr 23, 2024
fa66b7b
update docs
WaelKarkoub Apr 23, 2024
ffc42bf
Merge branch 'main' into aggregate-pytest-settings
WaelKarkoub Apr 23, 2024
5afe546
try fix
WaelKarkoub Apr 23, 2024
fd05f19
update workflows
WaelKarkoub Apr 23, 2024
906d857
undo minor fix
WaelKarkoub Apr 23, 2024
fd14708
Merge branch 'main' into aggregate-pytest-settings
WaelKarkoub Apr 25, 2024
01e73fa
resolve comments
WaelKarkoub Apr 25, 2024
81701f7
adds back pytest-asyncio
WaelKarkoub Apr 25, 2024
bcf70ed
minor fix
WaelKarkoub Apr 25, 2024
c66a077
add branch coverage
WaelKarkoub Apr 25, 2024
37e3df6
restore pip install e.
WaelKarkoub Apr 26, 2024
4c59355
merge fix
WaelKarkoub Apr 27, 2024
6337db0
test with coverage
WaelKarkoub Apr 27, 2024
75fe5c7
fix mypy
WaelKarkoub Apr 27, 2024
2082cce
fix coverage + docker + windows combo
WaelKarkoub Apr 27, 2024
cd0b71a
fix bash command
WaelKarkoub Apr 27, 2024
75d9ded
formatter
WaelKarkoub Apr 27, 2024
8e64170
formatter
WaelKarkoub Apr 28, 2024
0486063
one last fix
WaelKarkoub Apr 28, 2024
0761b58
I lied, last fix
WaelKarkoub Apr 28, 2024
876b121
fix
WaelKarkoub Apr 28, 2024
1ac793e
undo type ignore
WaelKarkoub Apr 28, 2024
9a1ceac
fix retrieve chat test
WaelKarkoub Apr 28, 2024
4ca79f1
fix windows paths
WaelKarkoub Apr 28, 2024
3af73df
change cache seed
WaelKarkoub Apr 28, 2024
8d0e1b2
down grade openai version
WaelKarkoub Apr 28, 2024
b745aba
fix openai mypy
WaelKarkoub Apr 28, 2024
efa757c
better error type
WaelKarkoub Apr 28, 2024
c18faff
fix image gen cache test
WaelKarkoub Apr 28, 2024
ffe4065
fix
WaelKarkoub Apr 28, 2024
b379c1e
experimenting
WaelKarkoub Apr 28, 2024
be36a57
fix lmm
WaelKarkoub Apr 28, 2024
f8c0d7c
skip cosmos test
WaelKarkoub Apr 28, 2024
6512ca8
remove cosmos db
WaelKarkoub Apr 28, 2024
b711be2
unused imports
WaelKarkoub Apr 28, 2024
677bf3c
handle more cosmosdb skips
WaelKarkoub Apr 28, 2024
13be649
fix flaky test
WaelKarkoub Apr 28, 2024
db588ac
Merge branch 'main' into aggregate-pytest-settings
WaelKarkoub Apr 28, 2024
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
7 changes: 3 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
python -m pip install --upgrade pip wheel
pip install -e .[cosmosdb]
python -c "import autogen"
pip install pytest mock
pip install pytest-cov>=5 mock
- name: Install optional dependencies for code executors
# code executors and udfs auto skip without deps, so only run for python 3.11
if: matrix.python-version == '3.11'
Expand All @@ -71,12 +71,11 @@ jobs:
if: matrix.python-version == '3.10'
run: |
pip install -e .[test,redis,websockets]
coverage run -a -m pytest test --ignore=test/agentchat/contrib --skip-openai --durations=10 --durations-min=1.0
coverage xml
pytest test --ignore=test/agentchat/contrib --skip-openai --durations=10 --durations-min=1.0
WaelKarkoub marked this conversation as resolved.
Show resolved Hide resolved
- name: Test with Cosmos DB
run: |
pip install -e .[test,cosmosdb]
coverage run -a -m pytest test/cache/test_cosmos_db_cache.py --skip-openai --durations=10 --durations-min=1.0
pytest test/cache/test_cosmos_db_cache.py --skip-openai --durations=10 --durations-min=1.0
- name: Upload coverage to Codecov
if: matrix.python-version == '3.10'
uses: codecov/codecov-action@v3
Expand Down
200 changes: 96 additions & 104 deletions .github/workflows/contrib-openai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ name: OpenAI4ContribTests

on:
pull_request:
branches: ['main']
branches: ["main"]
paths:
- 'autogen/**'
- 'test/agentchat/contrib/**'
- '.github/workflows/contrib-openai.yml'
- 'setup.py'
permissions: {}
# actions: read
- "autogen/**"
- "test/agentchat/contrib/**"
- ".github/workflows/contrib-openai.yml"
- "setup.py"
permissions:
{}
# actions: read
# checks: read
# contents: read
# deployments: read
Expand Down Expand Up @@ -55,7 +56,7 @@ jobs:
python -m pip install --upgrade pip wheel
pip install -e .
python -c "import autogen"
pip install coverage pytest-asyncio
pip install pytest-cov>=5 pytest-asyncio
- name: Install packages for test when needed
run: |
pip install docker
Expand All @@ -67,8 +68,7 @@ jobs:
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
run: |
coverage run -a -m pytest -k test_retrievechat test/agentchat/contrib/retrievechat
coverage xml
pytest test/agentchat/contrib/retrievechat/ test/agentchat/contrib/retrievechat
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
python -m pip install --upgrade pip wheel
pip install -e .
python -c "import autogen"
pip install coverage pytest-asyncio
pip install pytest-cov>=5 pytest-asyncio
- name: Install packages for test when needed
run: |
pip install docker
Expand All @@ -109,8 +109,7 @@ jobs:
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
run: |
coverage run -a -m pytest test/agentchat/contrib/test_compressible_agent.py
coverage xml
pytest test/agentchat/contrib/test_compressible_agent.py
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down Expand Up @@ -139,7 +138,7 @@ jobs:
python -m pip install --upgrade pip wheel
pip install -e .
python -c "import autogen"
pip install coverage pytest-asyncio
pip install pytest-cov>=5 pytest-asyncio
- name: Install packages for test when needed
run: |
pip install docker
Expand All @@ -150,8 +149,7 @@ jobs:
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
run: |
coverage run -a -m pytest test/agentchat/contrib/test_gpt_assistant.py
coverage xml
pytest test/agentchat/contrib/test_gpt_assistant.py
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down Expand Up @@ -180,16 +178,15 @@ jobs:
python -m pip install --upgrade pip wheel
pip install -e .[teachable]
python -c "import autogen"
pip install coverage pytest
pip install pytest-cov>=5
- name: Coverage
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
run: |
coverage run -a -m pytest test/agentchat/contrib/capabilities/test_teachable_agent.py
coverage xml
pytest test/agentchat/contrib/capabilities/test_teachable_agent.py
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand All @@ -198,8 +195,8 @@ jobs:
AgentBuilder:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.11" ]
os: [ubuntu-latest]
python-version: ["3.11"]
runs-on: ${{ matrix.os }}
environment: openai1
steps:
Expand All @@ -218,7 +215,7 @@ jobs:
python -m pip install --upgrade pip wheel
pip install -e .
python -c "import autogen"
pip install coverage pytest-asyncio
pip install pytest-cov>=5 pytest-asyncio
- name: Install packages for test when needed
run: |
pip install -e .[autobuild]
Expand All @@ -229,8 +226,7 @@ jobs:
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
run: |
coverage run -a -m pytest test/agentchat/contrib/test_agent_builder.py
coverage xml
pytest test/agentchat/contrib/test_agent_builder.py
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down Expand Up @@ -259,7 +255,7 @@ jobs:
python -m pip install --upgrade pip wheel
pip install -e .[websurfer]
python -c "import autogen"
pip install coverage pytest
pip install pytest-cov>=5
- name: Coverage
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
Expand All @@ -268,93 +264,90 @@ jobs:
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
BING_API_KEY: ${{ secrets.BING_API_KEY }}
run: |
coverage run -a -m pytest test/agentchat/contrib/test_web_surfer.py
coverage xml
pytest test/agentchat/contrib/test_web_surfer.py
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
ContextHandling:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]
runs-on: ${{ matrix.os }}
environment: openai1
steps:
# checkout to pr branch
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install packages and dependencies
run: |
docker --version
python -m pip install --upgrade pip wheel
pip install -e .
python -c "import autogen"
pip install coverage pytest
- name: Coverage
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
BING_API_KEY: ${{ secrets.BING_API_KEY }}
run: |
coverage run -a -m pytest test/agentchat/contrib/capabilities/test_context_handling.py
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]
runs-on: ${{ matrix.os }}
environment: openai1
steps:
# checkout to pr branch
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install packages and dependencies
run: |
docker --version
python -m pip install --upgrade pip wheel
pip install -e .
python -c "import autogen"
pip install pytest-cov>=5
- name: Coverage
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
BING_API_KEY: ${{ secrets.BING_API_KEY }}
run: |
pytest test/agentchat/contrib/capabilities/test_context_handling.py
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
ImageGen:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
runs-on: ${{ matrix.os }}
environment: openai1
steps:
# checkout to pr branch
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install packages and dependencies
run: |
docker --version
python -m pip install --upgrade pip wheel
pip install -e .[lmm]
python -c "import autogen"
pip install coverage pytest
- name: Coverage
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
coverage run -a -m pytest test/agentchat/contrib/capabilities/test_image_generation_capability.py
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
runs-on: ${{ matrix.os }}
environment: openai1
steps:
# checkout to pr branch
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install packages and dependencies
run: |
docker --version
python -m pip install --upgrade pip wheel
pip install -e .[lmm]
python -c "import autogen"
pip install pytest-cov>=5
- name: Coverage
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
pytest test/agentchat/contrib/capabilities/test_image_generation_capability.py
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests

AgentOptimizer:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.11" ]
os: [ubuntu-latest]
python-version: ["3.11"]
runs-on: ${{ matrix.os }}
environment: openai1
steps:
Expand All @@ -373,16 +366,15 @@ jobs:
python -m pip install --upgrade pip wheel
pip install -e .
python -c "import autogen"
pip install coverage pytest
pip install pytest-cov>=5
- name: Coverage
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
run: |
coverage run -a -m pytest test/agentchat/contrib/test_agent_optimizer.py
coverage xml
pytest test/agentchat/contrib/test_agent_optimizer.py
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
Loading
Loading