Pytest Enhanced โ a smarter
pytestcompanion that adds analytics, stability tracking, and CLI + web reports for developers who want insight, not just pass/fail output.
| Feature | โ pytest-enhanced | โช vanilla pytest |
|---|---|---|
| Detect flaky tests | โ Yes | โ No |
| Show slowest tests | โ Yes | โช Basic timing only |
| Pass-rate history | โ Yes | โ No |
| Persistent history (SQLite) | โ Yes | โ No |
| CSV / JSON export | โ Yes | โ No |
| HTML static reports | โ Yes | โ No |
| Web dashboard (FastAPI) | โ Beta | โ No |
| Rich CLI reports | โ Yes | โ Plain text |
| CI-ready analytics | โ Yes | โช Limited |
๐ง Built for developers who care about test reliability, not just test counts.
-
๐ Analytics for your tests
- Detect flaky or unstable tests automatically
- Identify slow tests and performance bottlenecks
- View historical pass-rate trends
-
โก Zero configuration
- Just run
pytest --enhanced - Works with any test suite, immediately
- Just run
-
๐พ SQLite storage
- Keeps history across multiple runs
- Simple local database, no external services
-
๐งฎ Export your test history
- Export all test data to CSV or JSON
- Perfect for CI pipelines or dashboards
-
๐จ Beautiful CLI reports
- Powered by
rich
- Powered by
-
๐งพ Static HTML reports
- Generate sharable test reports with a single command
pip install pytest-enhancedOr for development:
git clone https://github.com/pgnikolov/pytest-enhanced.git
cd pytest-enhanced
pip install -e .[dev]Run your tests with enhanced tracking:
pytest --enhancedThen view analytics:
pytest-enhanced reportOr inspect specific metrics:
pytest-enhanced slow
pytest-enhanced flaky
pytest-enhanced export --format csv๐ Pytest Enhanced Report โ Run #5
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Total tests: 8
Passed: 7 | Failed: 1 | Skipped: 0
Pass rate: 87.5%
๐ข Slowest tests:
demo_tests/test_sample.py::test_slow_one 1.24s
demo_tests/test_sample.py::test_api_latency 0.93s
๐ฅ Flaky tests:
test_random_fail 2 fails / 10 runs (20.0%)
๐ Pass rate trend:
Run 5: 87.5%
Run 4: 100.0%
Run 3: 90.0%
Run 2: 100.0%
Run 1: 95.0%
| Command | Description |
|---|---|
pytest-enhanced report |
Show full analytics for the latest run |
pytest-enhanced slow |
Display the slowest tests |
pytest-enhanced flaky |
List flaky or unstable tests |
pytest-enhanced export |
Export results to CSV or JSON |
pytest-enhanced html |
Generate a static HTML report |
pytest-enhanced web |
Start local FastAPI dashboard (beta) |
Export full history to CSV:
pytest-enhanced export --format csv --output results.csvOr JSON:
pytest-enhanced export --format json --limit 100Artifacts can be uploaded automatically in CI pipelines.
Generate a static HTML report of your test analytics โ ideal for CI artifacts or sharing with your team.
pytest-enhanced html --output report.htmlThen open report.html in your browser.
It includes:
- test summary
- slowest tests
- flaky tests
- pass rate history
Launch a lightweight local dashboard to explore your pytest-enhanced data:
pytest-enhanced webโก Opens at http://127.0.0.1:8000
View:
- historical runs
- flaky test frequency
- pass-rate trend over time
๐ง (Currently in beta, evolving towards interactive charts and filtering.)
pytest-enhanced/
โโโ pytest_enhanced/
โ โโโ plugin.py # pytest hooks
โ โโโ storage.py # SQLite logic
โ โโโ analysis.py # metrics & stats
โ โโโ cli.py # Typer CLI commands
โ โโโ report.py # rich output formatting
โ โโโ web/ # FastAPI dashboard
โ โโโ utils.py # helpers
โโโ demo_tests/ # example test files
โโโ tests/ # internal tests
โ
Includes a workflow: .github/workflows/pytest-enhanced.yml
Automatically:
- runs tests with
pytest --enhanced - exports analytics to CSV
- uploads report as a GitHub Action artifact
View data in Actions โ Artifacts.
- QA engineers tracking flaky tests
- Developers improving CI reliability
- TestOps engineers building dashboards
- Anyone tired of โgreen == doneโ thinking
git clone https://github.com/pgnikolov/pytest-enhanced.git
cd pytest-enhanced
pip install -e ".[dev]"
pytest --enhanced
pytest-enhanced report- CSV / JSON export command
- GitHub Action for CI analytics
- FastAPI-based web dashboard (beta)
- HTML reports (rich โ static)
- Publish on PyPI
Contributions welcome! You can:
- Submit pull requests
- Propose new analytics features
- Open issues or ideas
Licensed under the MIT License.
Created by Plamen Nikolov โ Python engineer, developer tooling enthusiast, and maker of things that improve test quality.
โก โYou canโt fix what you donโt measure โ pytest-enhanced helps you see the real picture.โ
