Skip to content

short test summary: different formats for skip, xfail and xpass #5077

Open
@anntzer

Description

@anntzer

Thanks for submitting an issue!

Here's a quick checklist in what to include:

  • Include a detailed description of the bug or suggestion
  • pip list of the virtual environment you are using
  • pytest and operating system versions
  • Minimal example if possible

In the report printed by pytest -ra, skip, xfail and xpass messages are formatted slightly differently from one another.

Python 3.7 / Arch Linux

$ pip list
Package        Version
-------------- -------
atomicwrites   1.3.0  
attrs          19.1.0 
more-itertools 7.0.0  
pip            19.0.3 
pluggy         0.9.0  
py             1.8.0  
pytest         4.4.0  
setuptools     40.8.0 
six            1.12.0
$ cat test_foo.py
import pytest

@pytest.mark.skip(reason="world")
def test_skip(): assert False

@pytest.mark.xfail(reason="hello")
def test_hello(): pass

@pytest.mark.xfail(reason="world")
def test_world(): assert False
$ pytest -ra
===================================== test session starts ======================================
platform linux -- Python 3.7.3, pytest-4.4.0, py-1.8.0, pluggy-0.9.0
rootdir: /tmp/foo
collected 3 items                                                                              

test_foo.py sXx                                                                          [100%]
=================================== short test summary info ====================================
SKIPPED [1] test_foo.py:3: world
XFAIL test_foo.py::test_world
  world
XPASS test_foo.py::test_hello hello

======================= 1 skipped, 1 xfailed, 1 xpassed in 0.02 seconds ========================

Notice that the skip message is the only one to include the line number and the xfail message the only one to be prepended with a newline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: reportingrelated to terminal output and user-facing messages and errorstype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions