Skip to main content

Pytest plugin to provide fixture timing reports

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_fixture_report-0.1.0.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_fixture_report-0.1.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file pytest_fixture_report-0.1.0.tar.gz.

File metadata

  • Download URL: pytest_fixture_report-0.1.0.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pytest_fixture_report-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7570a2a0553bff1f4700f68fd2d953d53c6f7b53a942676ead59d3fc08967a16
MD5 5a8fe614ed431e9cb6ff52d369525ede
BLAKE2b-256 fd4fd63e28336fba1516ac26d6c31895c5983c89963dc98c2cf911ebfd986d89

See more details on using hashes here.

File details

Details for the file pytest_fixture_report-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_fixture_report-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a8e02d04d713fdf1d728ba1113ac3b51be43e7495728767525f0bdc46bf3a79
MD5 e92ae53ff57d74a0de02dbdbb0e5a41e
BLAKE2b-256 9b2893b428c39e98ed3d3222f1ae0ee71b50c543a8dc4f69dd6d260e13e23bb4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page