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

ci: use tox for unit tests #4876

Open
wants to merge 22 commits into
base: fix-tox-ini
Choose a base branch
from
Open
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
49 changes: 36 additions & 13 deletions .github/workflows/python-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,35 +128,58 @@ jobs:
hatch run notebooks:clean
git diff --exit-code

unit-test:
unit-tests:
name: Unit Tests
runs-on: ${{ matrix.os }}
needs: changes
if: ${{ needs.changes.outputs.phoenix == 'true' }}
strategy:
matrix:
py: [ 3.9 ]
py: [ 3.9, 3.12 ]
os: [ ubuntu-latest, windows-latest, macos-13 ]
steps:
- name: Checkout Repository
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up python ${{ matrix.py }}
with:
sparse-checkout: |
requirements/
src/phoenix/
tests/unit/
tests/conftest.py
- name: Remove symbolic links (non-Windows)
run: find . -type l -delete
if: runner.os != 'Windows'
- name: Remove symbolic links (Windows)
run: |
Remove-Item src/phoenix/evals
Remove-Item src/phoenix/otel
shell: powershell
if: runner.os == 'Windows'
- name: Set up Python ${{ matrix.py }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip==${{ env.pip-version }}
pip install hatch
- name: Install PostgreSQL (Ubuntu)
- name: Set up `uv`
uses: astral-sh/setup-uv@v3
with:
version: 0.4.18
enable-cache: true
cache-dependency-glob: |
pyproject.toml
requirements/ci.txt
requirements/unit-tests.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up `tox` with `tox-uv`
run: uv tool install tox --with tox-uv
- name: Install PostgreSQL (Linux)
if: runner.os == 'Linux'
run: sudo apt-get -yqq install postgresql
- name: Run tests with PostgreSQL
- name: Run tests with PostgreSQL (Linux)
if: runner.os == 'Linux'
run: hatch run test:tests --run-postgres
- name: Run tests without PostgreSQL
run: tox run -e unit_tests -- -ra -x --run-postgres
- name: Run tests without PostgreSQL (non-Linux)
if: runner.os != 'Linux'
run: hatch run test:tests
run: tox run -e unit_tests -- -ra -x

integration-tests:
name: Integration Tests
Expand Down
1 change: 1 addition & 0 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pytest==8.3.3
pytest-xdist==3.6.1
pytest-asyncio==0.23.8
uvloop; platform_system != 'Windows'
pydantic>=1.0,!=2.0.*,<3
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fixes uv for Python 3.12

19 changes: 19 additions & 0 deletions requirements/unit-tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-r ci.txt
Faker>=30.1.0
arize
asgi-lifespan
asyncpg
grpc-interceptor[testing]
httpx # For OpenAI testing
litellm>=1.0.3
nest-asyncio # for executor testing
numpy
openai>=1.0.0
protobuf==3.20 # version minimum (for tests)
psycopg[binary,pool]
pytest-postgresql
responses
respx # For OpenAI testing
tenacity
tiktoken
typing-extensions==4.7.0
9 changes: 9 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,12 @@ commands =
ruff check --fix .
mypy .
pytest {posargs:.}

[testenv:unit_tests]
changedir = tests
deps =
-r requirements/unit-tests.txt
commands_pre =
uv pip install --reinstall ../.
commands =
pytest --ignore=integration {posargs}
Loading