pytest-vivarium
pytest-vivarium is a pytest plugin providing the
shared test configuration used across the
vivarium-suite monorepo and the
Institute for Health Metrics and Evaluation’s Simulation Science team’s model
repositories. Installing it as a test dependency auto-registers everything below
via pytest’s pytest11 entry point - there is nothing to import.
Markers and options
slowMark a test as slow. Skipped unless
--runslowis passed.weeklyMark a test as part of the weekly suite. Skipped unless
--runweeklyis passed or it is the designated slow-test day (Sunday).clusterMark a test as requiring a SLURM cluster. Skipped automatically when
sbatchis not on thePATH.--slurm-projectsets the SLURM project (defaultproj_simscience).
Bounded -n auto workers
The plugin implements pytest_xdist_auto_num_workers so that pytest -n auto
does not oversubscribe large shared nodes. The worker count targets a small
ceiling and is clamped to the process’s usable CPUs and to the memory available
to it - reading both node free memory and any cgroup (for example a SLURM
--mem) limit. The resolved plan is printed in the run header.
The no_gbd_cache fixture
no_gbd_cache disables vivarium_gbd_access caching for test isolation. It
is not autouse; wrap it in an autouse fixture in your own conftest.py
to apply it broadly.