Skip to content

xfail_strict has no effect in [tool.pytest] #3675

@calvertvl

Description

@calvertvl

This is verified against pytest-3.6.3 on CentOS 7 with Python 3.6.5 (installed via IUS).

When running pytest with tests marked with @pytest.mark.xfail and the result is an XPASS, enabling xfail_strict as follows does not cause the test suite to fail:

[tool.pytest]
xfail_strict = True

When enabling as follows, the same test suite will fail:

[pytest]
xfail_strict = True

The pip list output is:

atomicwrites (1.1.5)
attrs (18.1.0)
more-itertools (4.2.0)
pip (9.0.3)
pluggy (0.6.0)
py (1.5.4)
pytest (3.6.3)
setuptools (39.0.1)
six (1.11.0)

SSCCE:

  1. Install poetry.
  2. Set up basic demo project.
# keep your environment clean
poetry new --name example test-xfail-strict
cd test-xfail-strict
sed -i tests/test_example.py -e 's/def/import pytest\n\n@pytest.mark.xfail\ndef/'
  1. Demonstrate correct behavior with deprecated configuration
echo -e "[pytest]\nxfail_strict=true" > setup.cfg
poetry run pytest
  1. Demonstrate incorrect behavior with new configuration
echo -e "[tool.pytest]\nxfail_strict=true" > setup.cfg
poetry run pytest

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: questiongeneral question, might be closed after 2 weeks of inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions