Metadata-Version: 2.4
Name: pytest-fixture-report
Version: 0.1.0
Summary: Pytest plugin to provide fixture timing reports
Author-email: Daniel Edgecombe <edgy.edgemond@gmail.com>
Requires-Python: >=3.11
Requires-Dist: pytest
Provides-Extra: dev
Requires-Dist: bumpversion-slim>=0.1.0; extra == 'dev'
Requires-Dist: git-cliff>=2.12.0; extra == 'dev'
Requires-Dist: prek>=0.4; extra == 'dev'
Requires-Dist: pytest-cov>=6.1.1; extra == 'dev'
Requires-Dist: pytest-random-order>=1.2.0; extra == 'dev'
Requires-Dist: pytest>=8.3.5; extra == 'dev'
Requires-Dist: ruff>=0.14.10; extra == 'dev'
Requires-Dist: ty>=0.0.21; extra == 'dev'
Description-Content-Type: text/markdown

# Details

`pytest-fixture-report` is a pytest plugin aimed at assisting debugging slow tests. While
pytest provides `--durations=N`, this does not always provide enough granularity to find
problem areas, where they exist in test setup i.e. slow fixtures.

This plugin aims to fill that gap.

## Reports

Provider reports are:

* spent: Summary of total time spent in fixtures.
* cumul: Breakdown of N slowest fixtures by cumulative time.
* avg: Breakdown of N slowest fixtures by average time.
* most: Breakdown of N most called fixtures.

This assists in detecting fixtures that are very slow, but not called very often (top of cumul, but not avg/most),
and fixtures that aren't very slow, but are called too often (top of most, but not of avg).

Reports are all enabled by default, capturing N=25.

These can be configured using various flags:

* --fixture-report: Enable to report.
* --fr-slowest=N: Number of fixtures to report on in `cumul`, `avg` reports.
* --fr-most=N: Number of fixtures to report on in `most` report.
* --fr-reports: Comma separated list of reports to enable.

## Output

```
===================================== Time spent in fixtures 17.66s =====================================
=================================== Slowest 10 fixtures (cumulative) ====================================
account                                         8.86s
pogo_engine                                     2.26s
_trade_data                                     1.29s
channel                                         0.65s
db_session                                      0.62s
web_client                                      0.49s
basic_monthly                                   0.45s
user                                            0.45s
_patch_pg_pool                                  0.45s
app                                             0.39s
===================================== Slowest 10 fixtures (average) =====================================
pogo_engine                                     2.26s
app                                             0.39s
_trade_data                                     0.22s
postgres_dsn                                    0.09s
account                                         0.08s
db_connection                                   0.05s
pg_conn                                         0.02s
user                                            0.00s
everflow_config                                 0.00s
config                                          0.00s
======================================== Most called 5 fixtures =========================================
db_session                                      2397
monkeypatch                                     1458
city                                            1352
subscription_factory                            1343
basic_monthly                                   1340
```
