Skip to content

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Oct 5, 2022

We are currently using

vision/pytest.ini

Lines 3 to 4 in a46c4f0

# show summary of all tests that did not pass
-ra

which shows every test that is not passing in the summary. Meaning, skips and xfails are also shown although I'd would wager a guess that no one looks at them. Thus, this PR changes this to only show failures, errors, and xpasses.

Without this, adding markers to the parametrization will render the summary almost useless, since they all get a distinct mention:

import pytest


@pytest.mark.xfail
def test_foo():
    assert False


@pytest.mark.parametrize("baz", [pytest.param(i, marks=[pytest.mark.xfail]) for i in range(10)])
def test_bar(baz):
    assert False
  • -ra:

    ======================================== short test summary info =========================================
    XFAIL main.py::test_foo
    XFAIL main.py::test_bar[0]
    XFAIL main.py::test_bar[1]
    XFAIL main.py::test_bar[2]
    XFAIL main.py::test_bar[3]
    XFAIL main.py::test_bar[4]
    XFAIL main.py::test_bar[5]
    XFAIL main.py::test_bar[6]
    XFAIL main.py::test_bar[7]
    XFAIL main.py::test_bar[8]
    XFAIL main.py::test_bar[9]
    ========================================== 11 xfailed in 0.73s ===========================================
    
  • -rfEX:

    ========================================== 11 xfailed in 0.72s ===========================================
    

AFAIK, there is currently no occurrence of such pattern in our test suite yet, but will be soon #6653.

Copy link
Contributor

@YosuaMichael YosuaMichael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pmeier , the change looks good and I agree normally we don't need summary for those that are skipped or expected to fail.

I just have a minor NIT regarding the comment. I will approve first to unblock.

@pmeier pmeier merged commit d020820 into pytorch:main Oct 6, 2022
@pmeier pmeier deleted the pytest-summary branch October 6, 2022 07:15
@github-actions
Copy link

github-actions bot commented Oct 6, 2022

Hey @pmeier!

You merged this PR, but no labels were added. The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py

facebook-github-bot pushed a commit that referenced this pull request Oct 7, 2022
Summary:
* make pytest summary more concise

* fix comment

Reviewed By: datumbox

Differential Revision: D40138725

fbshipit-source-id: 37e67cf39c1a979219eba18de24bbd5d4f9e8b49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants