--- id: pytest-profiling version: "1.8.1" license: MIT license license_treatment: permissive maintenance: aging --- # pytest-profiling — Profiling plugin for py.test License: permissive · Maintenance: aging · Downloads: 1.9M/mo ## What it is and what it does pytest-profiling is a pytest plugin that automatically profiles test execution using Python's built-in cProfile module and outputs results as human-readable tables or SVG call graphs. When you run pytest with the --profile flag, the plugin captures CPU time and call counts for every function invoked during each test, then aggregates results into a combined.prof file alongside individual per-test profile files stored in a prof/ directory. The --profile-svg option generates visual heat graphs using gprof2dot and Graphviz, making it easy to spot performance bottlenecks at a glance. The plugin integrates seamlessly into pytest's test discovery and execution flow, requiring only a one-line fixture registration. It depends on six, pytest, and gprof2dot as runtime dependencies. The package is stable (Production/Stable status) and supports Python 3.6 through 3.12, though maintenance is aging—the last release was in late 2024 and the repository shows no recent activity. It is well-suited for developers who need to identify slow tests or understand where CPU time is spent during test runs. Use it for: - Identify which tests or test fixtures consume the most CPU time in a large test suite. - Generate SVG flame graphs to visualize function call hierarchies and spot performance regressions. - Analyze pstats files offline using Python's pstats module for deeper investigation of test performance. - Detect unexpected slowdowns in test execution after code changes by comparing prof files. - Profile integration tests that exercise multiple layers of an application to find bottlenecks. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Pytest plugin that profiles test execution using cProfile and generates tabular or SVG heat graph output of performance data. Yes, if you need to profile test performance. The plugin is stable, has low install friction, carries no license restrictions, and integrates directly into pytest with minimal configuration. The aging maintenance status (last release 623 days ago) is a minor concern but not a blocker—the package is feature-complete and no known vulnerabilities exist. Install it when you need to understand where CPU time goes during testing. ## Install pip install pytest-profiling uv add pytest-profiling poetry add pytest-profiling ## Installing pytest-profiling Before you install: Low friction install with only three runtime dependencies (six, pytest, gprof2dot). Maintenance status is aging—last release was 623 days ago—but the repository remains active and the package supports current Python versions (3.6–3.12). License in practice: MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects. Quickstart: pip install pytest-profiling # In conftest.py or test file: pytest_plugins = ['pytest_profiling'] # Run tests with profiling: # pytest tests/ --profile # pytest tests/ --profile-svg Graphviz (dot command) must be installed on the system to generate SVG output with --profile-svg. Verify before relying: - Whether pstats files are automatically cleaned up or retained indefinitely in the prof/ directory. - Performance overhead of profiling on test suites with thousands of tests. - Compatibility with pytest plugins that also instrument test execution. ## Package facts - License: MIT license (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 1.9M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest profiling plugin, test performance profiling, cProfile pytest integration, test execution analysis, profile test runtime, pytest performance visualization, test bottleneck detection, profiling, performance-analysis, test-debugging [View on SkillFed](https://skillfed.io/packages/pytest-profiling) · [View on PyPI](https://pypi.org/project/pytest-profiling/)