Add Unit Tests (#4)

This commit is contained in:
Lamont Huffman
2025-10-31 11:04:34 +08:00
committed by GitHub
parent 158a5e63b1
commit ef5c7d9aab
38 changed files with 1249 additions and 1122 deletions

21
.github/workflows/pre-commit.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Pre-commit
on: [push, pull_request]
jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: True
matrix:
os: [ubuntu-latest]
env:
OS: ${{ matrix.os }}
PYTHON: '3.10'
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.10'

View File

@@ -0,0 +1,37 @@
name: deep_research_runtime_test
on:
schedule:
- cron: '0 0 */3 * *'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Debug directory structure
run: |
echo "Current directory: $(pwd)"
ls -la
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
cd deep_research/agent_deep_research
pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-asyncio pytest-mock
- name: Run tests
run: |
python -m pytest tests/agent_deep_research_test.py -v

View File

@@ -0,0 +1,48 @@
name: BrowserAgent Tests
on:
schedule:
- cron: '0 0 */3 * *'
workflow_dispatch:
jobs:
test:
name: Run Tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.10"
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Debug directory structure
run: |
# ✅ Show actual directory structure
echo "Current directory: $(pwd)"
ls -la
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install Dependencies
run: |
cd browser_agent/agent_browser
python -m pip install --upgrade pip
pip install pytest pytest-asyncio
pip install -r requirements.txt
- name: Run Tests
env:
DASHSCOPE_API_KEY: ${{ secrets.DASHSCOPE_API_KEY }}
run: |
# ✅ Ensure test-results directory exists
mkdir -p test-results
# ✅ Run tests with XML output
python -m pytest tests/browser_agent_test.py -v

View File

@@ -0,0 +1,42 @@
name: browser_use_fullstack_runtime_test
on:
schedule:
- cron: '0 0 */3 * *'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Debug directory structure
run: |
# ✅ Show actual directory structure
echo "Current directory: $(pwd)"
ls -la
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
# ✅ Use validated path from debug output
cd browser_use/browser_use_fullstack_runtime/backend
pip install pytest pytest-asyncio
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
env:
DASHSCOPE_API_KEY: ${{ secrets.DASHSCOPE_API_KEY }}
run: |
# ✅ Use validated path from debug output
python -m pytest tests/browser_use_fullstack_runtime_test.py -v

View File

@@ -0,0 +1,36 @@
name: Conversational Agents Chatbot Test
on:
schedule:
- cron: '0 0 */3 * *'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
# ✅ Use correct relative path
cd conversational_agents/chatbot
python -m pip install --upgrade pip
pip install pytest pytest-asyncio
pip install -r requirements.txt
- name: Run tests
env:
DASHSCOPE_API_KEY: ${{ secrets.DASHSCOPE_API_KEY }}
run: |
# ✅ Use correct relative path
python -m pytest tests/conversational_agents_chatbot_test.py -v

View File

@@ -0,0 +1,37 @@
name: Flask API Runtime Test
on:
schedule:
- cron: '0 0 */3 * *'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Debug directory structure
run: |
echo "Current directory: $(pwd)"
ls -la
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
cd conversational_agents/chatbot_fullstack_runtime/backend
pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-asyncio
- name: Run tests
run: |
python -m pytest tests/conversational_agents_chatbot_fullstack_runtime_webserver_test.py -v

38
.github/workflows/test_evaluation.yml vendored Normal file
View File

@@ -0,0 +1,38 @@
name: ACE Benchmark Evaluation Test
on:
schedule:
- cron: '0 0 */3 * *'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Debug directory structure
run: |
echo "Current directory: $(pwd)"
ls -la
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install pytest pytest-asyncio pytest-mock
pip install agentscope ray
- name: Run tests
env:
DASHSCOPE_API_KEY: ${{ secrets.DASHSCOPE_API_KEY }}
run: |
python -m pytest tests/evaluation_test.py -v

38
.github/workflows/test_game.yml vendored Normal file
View File

@@ -0,0 +1,38 @@
name: Run test_game.py
on:
schedule:
- cron: '0 0 */3 * *'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Debug directory structure
run: |
# ✅ Show actual directory structure
echo "Current directory: $(pwd)"
ls -la
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.10
- name: Install dependencies
run: |
cd games/game_werewolves
pip install pytest pytest-asyncio
pip install -r requirements.txt
- name: Run game_test.py
env:
DASHSCOPE_API_KEY: ${{ secrets.DASHSCOPE_API_KEY }}
PYTHONPATH: ${{ env.GITHUB_WORKSPACE }}/games/game_werewolves
run: |
# ✅ Ensure correct working directory
python -m pytest tests/game_test.py -v