skillfed

pytest-textual-snapshot

Snapshot testing for Textual apps

pytest-textual-snapshot v1.1.0 343.8K downloads/30d#7,380 on PyPI
Permissive license MIT DORMANT released

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-snapshot

uv

uv add pytest-textual-snapshot

poetry

poetry add pytest-textual-snapshot

Installing 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

Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing

Tags

textual app snapshot testingpytest visual regression testingterminal ui screenshot comparisontextual tui testingsnapshot testing terminal apps
textual-testingvisual-regressionsnapshot-testing

More Testing packages