scipy / scipy_doctest

Floating-point aware doctesting
BSD 3-Clause "New" or "Revised" License
5 stars 4 forks source link

split `DTConfig.pytest_extra_skips` key into pytest-ignore, pytest-skip and pytest-xfail #132

Closed ev-br closed 5 months ago

ev-br commented 6 months ago

Need to allow both objects and paths, so that it works on both docstrings and tutorials.

ev-br commented 6 months ago

Here's how (TIL):

$ cat test_1.py 
import pytest

def test_smth():
    assert False

Then,

$ cat conftest.py 
import pytest

def pytest_collection_modifyitems(config, items):
    item = items[0]
    item.add_marker(pytest.mark.xfail(reason='programmatic'))

produces

$ pytest test_1.py -v
================================= test session starts ==================================
platform linux -- Python 3.10.10, pytest-8.0.1, pluggy-1.3.0 -- /home/br/mambaforge/envs/scipy-dev/bin/python3.10
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/br/sweethome/proj/scipy/refguide_check_2/scrtch/.hypothesis/examples')
rootdir: /home/br/sweethome/proj/scipy/refguide_check_2/scrtch
plugins: scpdt-0.1, anyio-4.2.0, cov-4.0.0, timeout-2.1.0, hypothesis-6.84.3, xdist-3.2.1
collected 1 item                                                                       

test_1.py::test_smth XFAIL (programmatic)                                        [100%]

================================== 1 xfailed in 0.14s ==================================