pytest-textual-snapshot
Snapshot testing for Textual apps
What it is and what it does
pytest-textual-snapshot is a pytest plugin that automates visual regression testing for Textual terminal user interface applications. It works by capturing SVG screenshots of your Textual app during test execution, storing them on disk, and comparing new screenshots against saved baselines on subsequent runs. When a screenshot differs from the baseline, the test fails and provides a diff report.
The plugin integrates directly into pytest via the snap_compare fixture, which accepts either a Textual App instance or a path to an app file. It supports simulating key presses, running setup code before capture, and customizing terminal dimensions to test different layouts. When snapshots change intentionally, you update them with the --snapshot-update flag. The package depends on pytest, rich, textual, syrupy, and jinja2.
Use it for:
- Detect unintended visual changes in Textual UI layouts, colors, or text rendering across code commits.
- Test responsive behavior of terminal apps by capturing snapshots at different terminal sizes.
- Verify that keyboard interactions produce the expected visual state after key presses.
- Automate regression detection for complex Textual dashboards or data-display applications.
- Document expected visual output of a Textual app by storing and reviewing baseline snapshots.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that captures SVG screenshots of Textual terminal applications and compares them across test runs to detect visual regressions automatically.
Yes, if you are actively developing Textual applications and want automated visual regression testing. The low install friction, permissive MIT license, and Production/Stable status make it straightforward to add to a pytest workflow. However, the dormant maintenance status (568 days since last release) means you should verify compatibility with your current Textual version before committing to it in a production pipeline.
Install
pytest-textual-snapshot on PyPI
pip
pip install pytest-textual-snapshotuv
uv add pytest-textual-snapshotpoetry
poetry add pytest-textual-snapshotInstalling pytest-textual-snapshot
Before you install
Low friction installation as a pure Python wheel. Dormant maintenance status (568 days since last release) means no active development, though marked Production/Stable.
License in practice
MIT license is permissive, allowing use in commercial and open-source projects with minimal restrictions—just retain the license notice.
Quickstart
pip install pytest-textual-snapshot
# In your test file:
def test_my_app(snap_compare):
app = MyTextualApp()
assert snap_compare(app)
# Or with key presses:
def test_with_interaction(snap_compare):
assert snap_compare("path/to/app.py", press=["tab", "left"])
Requires textual and pytest to be installed; your Textual app must be a non-running App instance or a path to a file containing an App subclass.
Verify before relying
- Whether the package works reliably with the latest versions of textual, given the dormant maintenance status.
- Performance characteristics when running large numbers of snapshot tests in parallel with pytest-xdist.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0.0,>=3.8.1) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — pytest, rich, textual, syrupy, jinja2 |
| Maintenance | dormant — 568 days since the last release |
| First released | |
| Downloads | 343,784/month — #7,380 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_textual_snapshot-1.1.0-py3-none-any.whl
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
pytest-playwright-visualA pytest plugin that captures and compares…
permissive · top 15,000 on PyPI
inline-snapshotinline-snapshot is a pytest plugin that lets…
permissive · top 5,000 on PyPI
percy-seleniumIntegrates Percy visual testing into Python…
permissive · top 15,000 on PyPI
percy-appium-appIntegrates Percy visual testing into Python…
permissive · top 15,000 on PyPI
snapshottestSnapshot testing library that captures API…
permissive · top 15,000 on PyPI
pytest-instaA pytest plugin that enables snapshot testing…
unclear · top 15,000 on PyPI
pytest-snapshotA pytest plugin that enables snapshot…
permissive · top 5,000 on PyPI
textual-devtextual-dev provides a command-line tool for…
permissive · top 15,000 on PyPI
syrupySyrupy is a pytest plugin that enables snapshot…
permissive · top 5,000 on PyPI
pytest-mplpytest-mpl is a pytest plugin that automates…
permissive · top 15,000 on PyPI