scripttest
Helper to test command-line scripts
What it is and what it does
scripttest is a testing library designed to help you verify the behavior of interactive command-line applications. It runs commands in subprocesses, captures their stdout and stderr output, and tracks any file modifications they produce. This makes it straightforward to write tests that validate what a CLI tool does without having to manually inspect output or filesystem state.
The library is built for developers testing their own command-line scripts and utilities. With no runtime dependencies and support for Python 3.8 through 3.13 on both CPython and PyPy, it's lightweight and compatible with modern Python environments.
Use it for:
- Test a custom command-line tool by running it and verifying stdout and stderr output.
- Validate that a CLI utility creates, modifies, or deletes files as expected during execution.
- Write integration tests for build tools or deployment scripts that need to verify subprocess behavior.
- Verify error handling in CLI applications by capturing and asserting on stderr output.
- Test command-line scripts in automated test suites without manual output inspection.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
scripttest runs command-line applications in subprocesses and captures their output and file modifications for testing purposes.
Yes. scripttest is actively maintained, has zero known vulnerabilities, carries a permissive MIT license, and installs with no dependencies. It is purpose-built for CLI testing and well-suited for any project that needs to verify command-line tool behavior in automated tests.
Install
scripttest on PyPI
pip
pip install scripttestuv
uv add scripttestpoetry
poetry add scripttestInstalling scripttest
Before you install
Low install friction with no runtime dependencies. Actively maintained as of 2026-07-08 with recent releases.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and closed projects.
Quickstart
pip install scripttest
from scripttest import TestFileEnvironment
env = TestFileEnvironment()
result = env.run('your-command')
assert result.stdout == 'expected output'
Verify before relying
- Whether scripttest integrates with unittest and doctest as suggested in the description excerpt.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 37 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 144,141/month — #11,160 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: scripttest-3.0-py3-none-any.whl
Keywords: test, unittest, doctest, command-line scripts
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
subprocess-teeA drop-in replacement for subprocess.run that…
permissive · top 5,000 on PyPI
spurProvides a unified Python interface to run…
permissive · top 15,000 on PyPI
runezA zero-dependency utility library providing…
permissive · top 5,000 on PyPI
subprocess.runProvides a simplified interface to run shell…
permissive · top 15,000 on PyPI
subprocess-multiteeMultiplexes subprocess stdout/stderr to…
unclear · top 15,000 on PyPI
fancy-subprocessRuns shell commands with formatted output,…
permissive · top 15,000 on PyPI
EasyProcessEasyProcess wraps Python's subprocess module to…
permissive · top 5,000 on PyPI
wurlitzerCaptures C-level stdout and stderr output in…
permissive · top 5,000 on PyPI
python-editorProgrammatically open your system's $EDITOR…
permissive · top 5,000 on PyPI
nose-py3nose-py3 extends unittest with automatic test…
copyleft · top 15,000 on PyPI