Skip to content

Repository files navigation

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

About

Pytest plugin providing fixture timing reports.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages