Skip to content

Releases: basnijholt/pytest-shm

Release list

v0.1.1

Choose a tag to compare

@basnijholt basnijholt released this 25 Sep 21:58
3bf90e5

Documentation only; the plugin is unchanged from v0.1.0.

Documentation

  • Add an animated logo: a memory module whose chips light up green one after another, like passing tests. It holds still under prefers-reduced-motion.
  • Present the MindRoom benchmark as one data point, and show how to measure your own suite (pytest vs pytest -o shm_min_free_gib=inf).
  • Describe the per-session cache caveat as a general pattern, with tiktoken as a labelled example.

v0.1.0

Choose a tag to compare

@basnijholt basnijholt released this 25 Sep 20:34

First release.

pytest-shm moves pytest's temporary files to the /dev/shm tmpfs, so suites that fsync (SQLite commits, atomic file replacement) stop waiting on the disk. In MindRoom's suite of about 26,000 tests, summed test time on a 32-worker NVMe machine fell from 5236 s to 1426 s.

Features

  • Points TMPDIR at /dev/shm before any conftest.py is imported, on Linux, when nothing else chose a temp root and /dev/shm is writable, executable, and has at least shm_min_free_gib GiB free (default 1).
  • Keeps bare tempfile output from session start on inside pytest's base directory, so it cannot hold memory until reboot.
  • Deletes a session's base directory when it passes, collects no tests, or stops at a usage error; failing sessions keep everything for inspection.
  • Works per worker under pytest-xdist: a failing run keeps only the directories of workers that saw a failure, and a caller's --basetemp is never deleted.
  • Stays off, and says why in the report header, when TMPDIR/TEMP/TMP is exported, --basetemp or PYTEST_DEBUG_TEMPROOT is outside /dev/shm, /dev/shm is missing, noexec, or too small, or -p no:tmpdir is passed.
  • Restores the caller's environment after in-process runs such as pytest.main().

Requires Python 3.10+ and pytest 8.4+.