Skip to content

Commit

Permalink
refactor: Migrates Python tests to pytest (#413)
Browse files Browse the repository at this point in the history
* Migrates test_api.py to pytest

Migrates test_api.py to pytest and removes `unittest`. Changes setup functions
to fixtures and replaces `unittest` assertion methods with regular Python `assert`s.

Also lowers the timeout for the server to make the tests run a bit faster.

* Updates test_binding.py to use pytest

Replaces all `unittest` APIs with equivalent `pytest` ones. This change
also updates the tests to use `tempfile` instead of manually creating and
removing files and directories.

* Parametrizes tests instead of running loops

* Updates L0 job to free space on host
  • Loading branch information
pranavm-nvidia authored Dec 13, 2024
1 parent 132f1d4 commit f7ff33f
Show file tree
Hide file tree
Showing 3 changed files with 294 additions and 320 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,27 @@ jobs:
image: nvcr.io/nvidia/tritonserver:24.10-py3
volumes:
- ${{ github.workspace }}:/core
# Mount /usr so we can free space
- /usr:/host_usr
env:
AGENT_TOOLSDIRECTORY: "$AGENT_TOOLSDIRECTORY"

steps:
- uses: actions/checkout@v3

- name: Free space
run: |
rm -rf \
/host_usr/share/dotnet /host_usr/local/lib/android /opt/ghc \
/host_usr/local/share/powershell /host_usr/share/swift /host_usr/local/.ghcup \
/host_usr/lib/jvm
rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Install dependencies
run: |
apt update
apt install -y --no-install-recommends clang-format-15 cmake libb64-dev rapidjson-dev libre2-dev
wget -O /tmp/boost.tar.gz https://archives.boost.io/release/1.80.0/source/boost_1_80_0.tar.gz && (cd /tmp && tar xzf boost.tar.gz) && mv /tmp/boost_1_80_0/boost /usr/include/boost
wget -O /tmp/boost.tar.gz https://archives.boost.io/release/1.80.0/source/boost_1_80_0.tar.gz && (cd /tmp && tar xzf boost.tar.gz) && mv /tmp/boost_1_80_0/boost /usr/include/boost && rm /tmp/boost.tar.gz
pip install build pytest
- name: Build
Expand Down
Loading

0 comments on commit f7ff33f

Please sign in to comment.