pytest-xprocess
A pytest plugin for managing processes across test runs.
What it is and what it does
pytest-xprocess is a pytest plugin that handles the lifecycle of external processes during test execution. Rather than starting and stopping a service (like a database, cache, or API server) for each test, it manages long-lived processes that can be reused across multiple tests, reducing test overhead and improving speed.
The plugin works by maintaining process state across test runs and providing fixtures to interact with these processes. It depends on pytest for the test framework integration and psutil for cross-platform process management. It supports Python 3.8 through 3.11 and is classified as Beta stability, indicating it is mature but may still have minor API changes.
Use it for:
- Start a database server once and reuse it across all tests instead of spinning up a new instance per test.
- Manage a mock API or HTTP service that multiple test cases need to communicate with.
- Control background worker processes or message queues during integration testing.
- Reduce test suite runtime by avoiding repeated startup costs of external services.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pytest-xprocess manages external processes (like servers or services) across pytest test runs, allowing tests to start, reuse, and control long-lived processes without restarting them for each test.
Yes, if your test suite relies on external processes. The plugin is actively maintained, has low install friction, carries no security vulnerabilities, and uses a permissive MIT license. It is well-suited for integration tests that need to manage services across multiple test runs.
Install
pytest-xprocess on PyPI
pip
pip install pytest-xprocessuv
uv add pytest-xprocesspoetry
poetry add pytest-xprocessInstalling pytest-xprocess
Before you install
Low friction install with only pytest and psutil as runtime dependencies. The package is actively maintained with a recent commit history and has been stable since its early releases.
License in practice
MIT license is permissive, allowing use in commercial and open-source projects with minimal restrictions.
Quickstart
pip install pytest-xprocess
import pytest
from pytest_xprocess import XProcess
def test_with_process(xprocess):
# xprocess manages the external process lifecycle
xprocess.ensure("my_service", lambda: ...)
Verify before relying
- Whether the plugin supports process cleanup and signal handling across different operating systems.
- Performance characteristics when managing many concurrent external processes.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pytest, psutil |
| Maintenance | actively maintained — 817 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 307,612/month — #7,774 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_xprocess-1.0.2-py3-none-any.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
pytest-forkedA pytest plugin that runs each test in a forked…
permissive · top 5,000 on PyPI
pytest-seleniumpytest-selenium is a pytest plugin that…
copyleft · top 15,000 on PyPI
pytest-postgresqlA pytest plugin that provides fixtures to…
copyleft · top 5,000 on PyPI
pytest-djangopytest-django integrates Django with pytest,…
permissive · top 1,000 on PyPI
pytest-datafilesA pytest plugin that copies specified files and…
permissive · top 15,000 on PyPI
pytest-redisA pytest plugin that provides fixtures for…
copyleft · top 15,000 on PyPI
pytest-vcrA pytest plugin that integrates VCR.py to…
permissive · top 5,000 on PyPI
testresourcestestresources extends unittest to manage…
permissive · top 15,000 on PyPI
circusCircus runs and watches multiple processes and…
permissive · top 15,000 on PyPI