pytest-test-analyzer
A powerful Python tool that analyzes pytest test files and generates comprehensive reports. Get deep insights into your test suite by analyzing test structure, decorator patterns, and test organization. Perfect for understanding and maintaining large test suites, tracking test coverage patterns, and identifying areas for test optimization.
Features
- 🔍 Analyzes pytest test files and directories
- 📊 Generates detailed statistics about test cases
- 🏷️ Tracks pytest markers and decorators
- 📝 Supports multiple output formats (HTML, Markdown, Text)
- 🎯 Filter tests by decorators
- 📈 Provides class-wise and marker-wise statistics
- 🎨 Beautiful HTML reports with charts
Installation
pip install pytest-test-analyzer
Usage
Basic Usage
Analyze a test directory and generate an HTML report:
pytest-test-analyzer --path "path/to/tests" --output report.html --format html
Command Line Options
pytest-test-analyzer --path PATH [--output OUTPUT] [--format FORMAT] [--include INCLUDE] [--exclude EXCLUDE]
--path: Path(s) to Python test files or directories (required)--output: Output file path--format: Output format - txt, html, or md (default: html)--include: Include only tests with specific decorators--exclude: Exclude tests with specific decorators
Examples
Analyzing Test Files
-
Analyze a single test file:
pytest-test-analyzer --path "tests/test_login.py" --output login_analysis.html --format html
-
Analyze multiple specific test files:
pytest-test-analyzer --path "tests/test_login.py" "tests/test_registration.py" --output auth_analysis.html
-
Analyze test files with specific patterns:
pytest-test-analyzer --path "tests/test_*_api.py" --output api_analysis.html
Analyzing Test Directories
-
Analyze a single test directory:
pytest-test-analyzer --path ./tests --output report.html --format html
-
Analyze multiple test directories:
pytest-test-analyzer --path ./tests ./integration_tests --output report.html
-
Analyze nested test directories:
pytest-test-analyzer --path ./tests/unit ./tests/integration --output nested_analysis.html
Filtering Tests
-
Include only tests with specific decorators:
pytest-test-analyzer --path ./tests --include pytest.mark.sanity pytest.mark.regression
-
Exclude tests with specific decorators:
pytest-test-analyzer --path ./tests --exclude pytest.mark.skip pytest.mark.xfail
-
Combine file and decorator filters:
pytest-test-analyzer --path "tests/test_api.py" --include pytest.mark.smoke --output api_smoke.html
Output Formats
-
Generate a markdown report:
pytest-test-analyzer --path ./tests --output report.md --format md
-
Generate a text report:
pytest-test-analyzer --path ./tests --output report.txt --format txt
-
Generate HTML report with custom name:
pytest-test-analyzer --path ./tests --output custom_name.html --format html
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you encounter any issues or have questions, please open an issue on GitHub.
Metadata
Release files for pytest-test-analyzer 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest_test_analyzer-0.1.1.tar.gz | 36.5 kB | Without provenance | Details for pytest_test_analyzer-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_test_analyzer-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for pytest_test_analyzer-0.1.1-py3-none-any.whl |
Total release size: 68.2 kB
Release files / pytest_test_analyzer-0.1.1.tar.gz
| Download URL | pytest_test_analyzer-0.1.1.tar.gz |
|---|---|
| Size | 36.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b11b757f2f431b0536d264d555cb5439db7878678e5cc73f528ce9c13599fd9
|
|
BLAKE2b-256 checksum How to use checksums |
a3d6f924e38d4ab603ac7d4d444c51bf264f7d23d530d13bbfc9689cd1cc5cf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / pytest_test_analyzer-0.1.1-py3-none-any.whl
| Download URL | pytest_test_analyzer-0.1.1-py3-none-any.whl |
|---|---|
| Size | 31.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
800007eb336cc7309e51eb459ff339db48aa4dccab0e95c4daaf38326c423c88
|
|
BLAKE2b-256 checksum How to use checksums |
be6fb6e3bddc1899835cd91244e8635e478ebdcccd8db60ad5d2a104bc9e6a95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for pytest-test-analyzer 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.