Visitar URL original
Short test summary doesn't show the test name when skipping from a fixture · Issue #10457 · pytest-dev/pytest · GitHub
Skip to content

Short test summary doesn't show the test name when skipping from a fixture #10457

Closed

Description

@varunsh-xilinx

I'm using Pytest 7.0.1on Ubuntu 18.04 with Python 3.6.9.

Consider a test:

def test_0(bar):
    assert 0

and a fixture defined in conftest.py that will skip a test based on some conditional check.

import pytest

@pytest.fixture
def bar():
    if some_condition:
        pytest.skip("Skipping")

Then running the test with pytest shows something like:

$ pytest . -rs
================================== test session starts ==================================
platform linux -- Python 3.6.9, pytest-7.0.1, pluggy-1.0.0
rootdir: /tmp/foo
plugins: cpp-2.1.2
collected 1 item                                                                        

test_foo.py s                                                                     [100%]

================================ short test summary info ================================
SKIPPED [1] conftest.py:6: Skipping
================================== 1 skipped in 0.01s ===================================

The summary shows that some test was skipped but there's no indication which test was skipped. Instead, it should show the test name rather than the location in the fixture where the pytest.skip was called from. If there are multiple tests that are skipped from various locations, matching a test with its skip condition becomes impossible.

There are some similar issues in #114, #748, #760 which may be related.

Activity

  1. The-Compiler commented on Nov 1, 2022

    @The-Compiler
    Member

    Also reproduces with pytest 7.2.

  2. added
    type: bugproblem that needs to be addressed
    topic: reportingrelated to terminal output and user-facing messages and errors
    on Nov 2, 2022
  3. DanielVZ96 commented on Nov 8, 2022

    @DanielVZ96
    Contributor

    I took the freedom of suggesting a fix for this issue in this PR.

  4. added a commit that references this issue on Nov 18, 2022
    791b51d
  5. added 2 commits that reference this issue on Apr 18, 2026
    7e55edb
    eb42094
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

    topic: reportingrelated to terminal output and user-facing messages and errorstype: 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