Skip to content

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

@varunsh-xilinx

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.

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