GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `-vv` should not override `--durations-min` · Issue #12938 · pytest-dev/pytest

-vv should not override --durations-min #12938

New issue
Copy link
New issue
Copy link
Closed
#13100
Closed
-vv should not override --durations-min#12938
#13100
Copy link
Labels
type: bugproblem that needs to be addressed

Description

@JulianJvn
JulianJvn
opened on Nov 4, 2024
Issue body actions

What's the problem this feature will solve?

I'd like pytest to give the full output on test failures for debugging purposes (by specifying -vv) while still being able to print the durations of tests and fixtures that exceed a given threshold (by using --durations-min).

  • It's not documented neither in pytest --help nor in the documentation that --durations-min has no effect if -vv is specified. I had to look at pytest's code to learn this:

    pytest/src/_pytest/runner.py

    Line 93 in 3ef3c2d

    if verbose < 2 and rep.duration < durations_min:
    The documentation only says the default behavior is equivalent to --durations-min 0.005 to when -vv is not specified. It does not say custom --durations-min values have no effect if -vv is specified. So, if this issue is not implemented, it is at least a documentation bug.
  • It's asymmetric/inconsistent that --durations still has effect if -vv specified, but --durations-min does not.
  • It's unexpected that a more specific option like --durations-min is overridden by a less specific option like --verbose.

The options currently work like this, depending if they're specified (Y) or not (N) or if it doesn't matter whether they're specified or not (*):

--durations=N --durations-min=X -vv Behavior
N * * No durations are displayed
Y N N Top N durations with duration ≥ 0.005s are displayed
Y Y N Top N durations with duration ≥ X are displayed
Y * Y Top N durations are displayed

Describe the solution you'd like

If --durations-min is explicitly specified, it should have precedence over -vv. The options could work like this:

--durations=N --durations-min=X -vv Behavior
N * * No durations are displayed
Y N N Top N durations with duration ≥ 0.005s are displayed
Y N Y Top N durations are displayed
Y Y * Top N durations with duration ≥ X are displayed

Alternative Solutions

Another possibility that would work for me is removing the feature that -vv changes the default value of --durations-min, i.e., the options would be decoupled. The previous behavior could be easily restored with --durations-min=0. The options would then work like this:

--durations=N --durations-min=X -vv Behavior
N * * No durations are displayed
Y N * Top N durations with duration ≥ 0.005s are displayed
Y Y * Top N durations with duration ≥ X are displayed

Additional context

—

Activity

  1. Zac-HD
    added
    type: bugproblem that needs to be addressed
    on Dec 24, 2024
  2. Zac-HD commented on Dec 24, 2024

    @Zac-HD
    Zac-HD
    on Dec 24, 2024
    Member
    More actions

    If --durations-min is explicitly specified, it should have precedence over -vv.

    Sounds good to me! Want to send a PR?

  3. JulianJvn commented on Jan 2, 2025

    @JulianJvn
    JulianJvn
    on Jan 2, 2025
    ContributorAuthor
    More actions

    Here you go!

  4. Zac-HD
    added a commit that references this issue on Jan 8, 2025

    Merge pull request #13100 from JulianJvn/durations-min-precedence

    535436f
  5. Zac-HD
    closed this as completedin #13100on Jan 8, 2025
  6. gilfree
    added 2 commits that reference this issue on Jun 8, 2025

    fix for pytest-8.4.0 compatibility

    3eba628

    fix for pytest-8.4.0 compatibility

    5037c7f
  7. luketainton
    added a commit that references this issue on Jan 5, 2026

    chore(deps): update dependency pytest to v9 (#305)

    4b75154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.