$npx skillfedfor your agent

pytest-console-scripts

Pytest plugin for testing console scripts

With conditionsPyPI TestingReleased May 2023241.5K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pytest_console_scripts-1.4.1-py3-none-any.whl
v1.4.1 · released 2023-05-31 · Python >=3.8 · 2 runtime deps: pytest, importlib-metadata

Yes, if you maintain Python CLI tools or console scripts and want to test them within pytest. The dual execution mode (in-process for speed, subprocess for realism) is a genuine advantage over subprocess.run() alone. However, note that the package is aging—last release was May 2023 with no recent commits—so verify compatibility with your pytest version before adopting. No known security vulnerabilities.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.8+ and pytest 4.0 or newer.
  • Console scripts must be installed (via entry_points or on PATH) before tests run.
  • Low friction install with only pytest and importlib-metadata as runtime dependencies.

License · maintenance · safety

MIT (permissive) — MIT license is permissive; you can use this package freely in commercial and open-source projects without restriction.

last release 2023-05-31 (1171 days) · last repo commit 2026-01-09 · 87 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 241,463 downloads/mo, #8,876 on PyPI

Verify before relying

pip install pytest-console-scripts

from pytest_console_scripts import ScriptRunner

def test_script(script_runner: ScriptRunner):
    result = script_runner.run(['my-script', '--version'])
    assert result.returncode == 0
  • Whether the aging maintenance status (last release May 2023) affects compatibility with recent pytest versions.
  • Current test coverage and whether the package is actively maintained despite unarchived status.
Same gist for agents: .md · .json

What it is and what it does

pytest-console-scripts is a pytest plugin that lets you test Python console scripts as if they were being run from the command line. It provides a `script_runner` fixture that captures output and return codes, and offers two execution modes: in-process (where the script runs in the same Python interpreter as pytest, speeding up test suites) and subprocess (where the script runs in a fresh interpreter, simulating real-world invocation more closely).

You can run scripts installed via console_scripts entry points, standalone Python files, or executables on the PATH. The plugin supports configuring execution mode globally via pytest config, per-test via command-line flags, or per-test via pytest markers. In-process mode enables mocking of script internals, while subprocess mode validates that scripts work correctly when invoked independently.

Use it for

  • Test CLI tools and console scripts installed via setup.py entry_points during development.
  • Validate that scripts behave identically when run in-process (fast) and subprocess (realistic) modes.
  • Capture and assert on stdout, stderr, and return codes from Python scripts in test suites.
  • Mock functions inside console scripts during in-process test runs to isolate behavior.
  • Speed up test iteration by running scripts in-process, then verify with subprocess mode in CI.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you maintain Python CLI tools or console scripts and want to test them within pytest.

The dual execution mode (in-process for speed, subprocess for realism) is a genuine advantage over subprocess.run() alone. However, note that the package is aging—last release was May 2023 with no recent commits—so verify compatibility with your pytest version before adopting. No known security vulnerabilities.

Install

pytest-console-scripts on PyPI

Before you install

Low friction install with only pytest and importlib-metadata as runtime dependencies. Maintenance status is aging—last release was 2023-05-31 and the repository shows no recent activity, though it remains unarchived.

Requires Python 3.8+ and pytest 4.0 or newer. Console scripts must be installed (via entry_points or on PATH) before tests run.

License in practice

MIT license is permissive; you can use this package freely in commercial and open-source projects without restriction.

Quickstart

pip install pytest-console-scripts

from pytest_console_scripts import ScriptRunner

def test_script(script_runner: ScriptRunner):
    result = script_runner.run(['my-script', '--version'])
    assert result.returncode == 0

Verify before relying

  • Whether the aging maintenance status (last release May 2023) affects compatibility with recent pytest versions.
  • Current test coverage and whether the package is actively maintained despite unarchived status.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.8
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
pytestimportlib-metadata
MaintenanceAging 1,171 days since the last release
Last repo commit
First released
Downloads241,463 / month, #8,876 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 4 - BetaFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing

Evidence: pytest_console_scripts-1.4.1-py3-none-any.whl

Tags

Capabilities
pytest plugin run console scriptstest python scripts subprocesspytest script runner fixturein-process script execution testingconsole entry point testing
Topics
cli-testingscript-runnerpytest-plugin

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “pytest plugin run console scripts”

  • pytest-console-scriptsA pytest plugin that runs Python console scripts within tests,…
  • pytest-loggingA pytest plugin that configures Python logging to output to the…
  • pytest-xvfbA pytest plugin that automatically runs tests with Xvfb (or…

Give your agent the search over MCP, or paste the wish link into any chat.

More Testing packages

pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
pytest Worth it
PyPI · Libraries · released Jun 2026

pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.

MITpure Python · 3.10+
1.1Bdownloads / mo
virtualenv Worth it
PyPI · Libraries · released Aug 2026

virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.

MITpure Python · 3.9+
532.9Mdownloads / mo
coverage Worth it
PyPI · Testing · released Aug 2026

Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.

Install it if you want to measure test completeness or enforce coverage thresholds in your project.

permissive licensepure Python · 3.10+
335.8Mdownloads / mo
pytest-asyncio Worth it
PyPI · Testing · released May 2026

pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.

Install it if you write tests for any asyncio-based code.

Apache-2.0pure Python · 3.10+
275.9Mdownloads / mo
pytest-json-ctrf Worth it
PyPI · Testing · released Jul 2026

A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.

Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.

MITpure Python · 3.8+
273.0Mdownloads / mo

See also pytest-subprocess · pytest-logging · pytest-subtests · pytest-mock · pytest-httpx2 · pytest-grpc · pytest-ansible · subprocess-tee · pytest_httpserver · pytest-freezegun