Fixed the functional test failure by removing MODEL_ENDPOINT_0 from the functional test step in GitHub Actions workflow. The functional test test_initialize_model_map_with_env_vars sets its own test endpoints (MODEL_ENDPOINT_1, MODEL_ENDPOINT_2) and was failing because MODEL_ENDPOINT_0 from the workflow was interfering. Changes: - .github/workflows/test.yml: Removed MODEL_ENDPOINT_0 from functional test step - .github/workflows/test.yml: Updated unit/integration tests to use hermes.ai.unturf.com - tests/functional/test_guarded_ai.py: Fixed patch.dict to use clear=False Unit and integration tests still have MODEL_ENDPOINT_0 configured since they need it for app initialization. Functional tests now run without env var interference and can test their own endpoint configs. All 46 functional tests pass locally.
96 lines
2.5 KiB
YAML
96 lines
2.5 KiB
YAML
name: Run Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master, develop, claude/** ]
|
|
pull_request:
|
|
branches: [ main, master, develop ]
|
|
|
|
# Cancel in-progress runs when a new commit is pushed
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python 3.13
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.13'
|
|
cache: 'pip'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install -r requirements-test.txt
|
|
|
|
- name: Run unit tests
|
|
run: |
|
|
pytest tests/unit/ -v --tb=short --cov=. --cov-report=term-missing
|
|
env:
|
|
SQLALCHEMY_DATABASE_URI: "sqlite:///:memory:"
|
|
TESTING: "1"
|
|
MODEL_ENDPOINT_0: "https://hermes.ai.unturf.com/v1"
|
|
MODEL_API_KEY_0: "dummy"
|
|
|
|
- name: Run functional tests
|
|
run: |
|
|
pytest tests/functional/ -v --tb=short
|
|
env:
|
|
SQLALCHEMY_DATABASE_URI: "sqlite:///:memory:"
|
|
TESTING: "1"
|
|
|
|
- name: Run integration tests
|
|
run: |
|
|
pytest tests/integration/ -v --tb=short
|
|
env:
|
|
SQLALCHEMY_DATABASE_URI: "sqlite:///:memory:"
|
|
TESTING: "1"
|
|
MODEL_ENDPOINT_0: "https://hermes.ai.unturf.com/v1"
|
|
MODEL_API_KEY_0: "dummy"
|
|
|
|
- name: Validate activity YAML files
|
|
run: |
|
|
python activity_yaml_validator.py research/SPEC.yaml
|
|
python activity_yaml_validator.py research/activity*.yaml
|
|
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python 3.13
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.13'
|
|
cache: 'pip'
|
|
|
|
- name: Install linting dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install black flake8
|
|
|
|
- name: Check code formatting with black
|
|
run: |
|
|
black --check --diff .
|
|
continue-on-error: true
|
|
|
|
- name: Lint with flake8 (syntax errors)
|
|
run: |
|
|
# Stop the build if there are Python syntax errors or undefined names
|
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
|
|
- name: Lint with flake8 (style warnings)
|
|
run: |
|
|
# Exit-zero treats all errors as warnings
|
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
|
continue-on-error: true
|