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 — wasxfail result outcome attribute not consistent for XFailed tests · Issue #11067 · pytest-dev/pytest

wasxfail result outcome attribute not consistent for XFailed tests #11067

New issue
Copy link
New issue
Copy link
Closed
#13328
Closed
wasxfail result outcome attribute not consistent for XFailed tests#11067
#13328
Copy link
Labels
type: enhancementnew feature or API change, should be merged into features branch

Description

@harmin-parra
harmin-parra
opened on Jun 1, 2023
Issue body actions

content of conftest.py:

@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
    outcome = yield
    report = outcome.get_result()

    if report.when == 'call':
        xfail = hasattr(report, 'wasxfail')        
        if not report.failed and not report.skipped and not xfail:
            print("Passed")
        elif report.failed and not report.skipped:
            print("Failed")
        elif not report.failed and not report.skipped and xfail:
            print("XPassed")
        elif not report.failed and report.skipped:
            print("XFailed")
            if xfail:
                print("Reason: ", report.wasxfail)

content of xfailed_test.py:

import pytest

@pytest.mark.xfail(reason="test_1")
def test_1():
    assert False

def test_2():
    pytest.xfail(reason="test_2")

The output of the test is:

XFailed
Reason: test_1
XFailed
Reason:  reason: test_2

The first test xfailed because of a marker, and the second test xfailed due to an explicit call to pytest.fail function.

The outputs are not coherent

The output for test_2 should be Reason: test_2 instead of Reason: reason: test_2

Tested with version 7.3.1

Activity

  1. harmin-parra
    changed the title [-]wasxfail report outcome attribute not consistent for XFailed tests[/-] [+]wasxfail result outcome attribute not consistent for XFailed tests[/+] on Jun 1, 2023
  2. Zac-HD
    added
    type: enhancementnew feature or API change, should be merged into features branch
    on Jun 4, 2023
  3. nicoddemus
    closed this as completedin #13328on Apr 2, 2025
  4. nicoddemus
    closed this as completedin 682013don Apr 2, 2025
  5. BahramF73
    added a commit that references this issue on Apr 2, 2025

    Make wasxfail consistent (pytest-dev#13328)

    This issue will close once commit 682013d is merged into the 'main' branch.
    682013d
  6. 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: 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

      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.