Testing
Run the fast test suite during development:
pytest tests/ -v
Slow, GPU, Simpleware, and tutorial tests are auto-skipped unless their opt-in flag is passed. Tests that depend on downloadable data fetch it automatically via the session fixtures, so no marker filter is needed for them.
Opt-in Buckets
Each --run-<bucket> flag enables one marker family:
pytest tests/ -v --run-slow # tests marked 'slow'
pytest tests/ -v --run-gpu # tests marked 'requires_gpu'
pytest tests/ -v --run-simpleware # tests marked 'requires_simpleware'
pytest tests/ -v --run-physicsnemo # tests marked 'requires_physicsnemo'
pytest tests/ -v --run-tutorials # tests marked 'tutorial'
Flags compose. A typical local GPU profile is:
pytest tests/ -v --run-gpu --run-slow
--run-all is a convenience flag that turns on every --run-* bucket at
once and implies --require-tutorial-data, so a missing dataset fails the
run instead of skipping its tests. The self-hosted CI GPU runner uses it (after installing CUDA PyTorch,
torch-scatter and cuDSS, then .[dev], which includes the netgen
and aorta extras):
pytest tests/ -v --run-all
Three further markers are declared but not gated by a flag: unit and
integration are descriptive, and xdist_group is a pytest-xdist
builtin used to keep related tests on one worker. Tests carrying only these
markers always run.
tests/test_tutorials.py holds the tutorial bucket. It is not
parametrized over the tutorials directory - it is one hand-written class per
covered script, currently all 29 tutorial scripts, so adding a tutorial does
not automatically add a test.
Test Categories
# CLI help smoke tests
pytest tests/test_cli_smoke.py -v
# Public import surface
pytest tests/test_import_public_api.py -v
Specific Areas
pytest tests/test_convert_vtk_to_usd.py -v
pytest tests/test_convert_image_4d_to_3d.py -v
pytest tests/test_contour_mesh_extraction.py -v --run-gpu
pytest tests/test_process_transforms.py -v
pytest tests/test_process_images.py -v
pytest tests/test_workflow_train_physicsnemo.py -v
pytest tests/test_workflow_evaluate_movement.py -v
Real Data and GPU Tests
Tests that need downloadable data request the session fixtures
(test_directories, download_test_data, test_images); the data is
downloaded on first use, so these tests run by default. GPU-bound tests are
marked requires_gpu (opt-in via --run-gpu); Simpleware-bound tests are
marked requires_simpleware (opt-in via --run-simpleware and require a
licensed Simpleware Medical installation locally: ASCardio for the
segmentation tests, +FE Free for the meshing tests).
The Warp flow and wall tests (test_warp_flow_ns.py,
test_warp_fluid_structure_ns.py, test_warp_hyperelastic_wall.py and
the 3D and fluid-structure aorta workflow tests) and the Tutorial 20 and 21
tests also need the NVIDIA cuDSS library, which
WarpCuDssFactor.find_library finds through CUDSS_LIBRARY, an
nvidia-cudss wheel or the system library search path (see
Installation). Without it they skip even with --run-gpu or
--run-tutorials; add -rs to list the skip reasons.
Optional Python Backends
The netgen meshing tests
(TestExtractLabelTetrahedraExternal in tests/test_contour_mesh_extraction.py) need
the netgen extra and skip with a reason when netgen-mesher is not
installed. The dev extra includes it:
# netgen and Simpleware tetrahedral meshing
pytest tests/test_contour_mesh_extraction.py -v -k TestExtractLabelTetrahedraExternal --run-gpu --run-simpleware
The aorta tests (tests/test_aorta_*.py and the Tutorial 19 to 21 tests
in tests/test_tutorials.py) need the aorta extra. In practice netgen,
which it includes, is what gates them: the 3D and FSI meshing tests and the
Tutorial 20 and 21 tests skip without it. The other aorta requirement,
scikit-image, also arrives through base dependencies such as
TotalSegmentator, so the scikit-image skip in the aorta test modules only
matters for an install without it. The dev extra includes aorta.
Continuous Integration
CI runs the fast subset by default. The self-hosted GPU runner installs CUDA
PyTorch, torch-scatter and cuDSS, then .[dev] (which includes the
netgen and aorta extras), and invokes pytest with --run-all (which
enables every --run-* bucket); tests whose host requirements aren’t met
(e.g. a licensed Simpleware install on a runner without one) runtime-skip
cleanly via their internal guards.