pytest-dev / pytest-dev/pytest

Breakdown of setup duration

Open
#8,079 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: fixtures topic: reporting type: proposal
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

At the moment, pytest aggregates together setup duration per test and displays it within the duration. This means if a setup is slow, you can identify it. However, if a setup is composed of multiple fixtures, there's no easy way to discern how much each of those fixtures took. Would be nice to have this information is shown, something like:

15.66s setup    tests/test_provision.py::test_provision_requires_ok(fixture_a[5]+fixture_b[3]+fixture_c[7]s)

If the setup contains a single fixture, we can omit this part and not show fixtures whose time is less than 0.1.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests; start by locating pytest's setup-duration reporting entry point and its existing duration-reporting tests. Done means multi-fixture setup output shows each fixture's duration, while single-fixture setup can omit the breakdown and fixtures under 0.1 seconds are omitted.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.