Python tests and samples
The tests/python_tests/ directory contains a pytest suite that exercises the EP
through the public ONNX Runtime Python API.
Setup
Set up a virtual environment from the repo root:
python -m venv .venv-pytests
.\.venv-pytests\Scripts\Activate.ps1
pip install -r tests\python_tests\requirements.txt
pip install path\to\onnxruntime_ep_nv_tensorrt_rtx-*.whl
Use the onnxruntime version from the release notes for your EP release.
Run
Run pytest from inside tests\python_tests so test artifacts land next to the
tests rather than in the repo root:
cd tests\python_tests
python -m pytest -v
Coverage
Test file |
What it covers |
|---|---|
|
EP library registration, device discovery, unregister and re-register |
|
Session creation with explicit EP devices and provider options |
|
EPContext creation and reload via |
|
Compile API file and bytes coverage (requires |
|
Proto-preprocessing passes exercised indirectly through compile |
Notes
Tests require an NVIDIA RTX GPU to run.
The compile tests (
test_compile_model.py) requireonnxruntime1.27+ which includesonnxruntime.ModelCompiler. No special build needed —pip install onnxruntime>=1.27is sufficient.Test artifacts (ONNX models, EPContext files, cache directories) are written to the current working directory and are not auto-cleaned between runs.