skillfed

scripttest

Helper to test command-line scripts

scripttest v3.0 144.1K downloads/30d#11,160 on PyPI59
Permissive license MIT Active released

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 scripttest

uv

uv add scripttest

poetry

poetry add scripttest

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming 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

test command-line scriptssubprocess output testinginteractive CLI testingcommand execution testingshell script testingstdout stderr captureCLI application testing
cli-testingsubprocess-automation

More Testing packages