twmr / pytest-sphinx

sphinx doctest plugin for pytest
BSD 3-Clause "New" or "Revised" License
30 stars 6 forks source link

pytest 8 compatibility #60

Closed jab closed 9 months ago

jab commented 9 months ago

Currently using the latest release of pytest-sphinx (0.5.0) with the latest release of pytest (8.0) breaks with errors like

_____________________ ERROR collecting bidict/__init__.py ______________________
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/pytest_sphinx.py:499: in collect
    optionflags = _pytest.doctest.get_optionflags(self)
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/_pytest/doctest.py:404: in get_optionflags
    optionflags_str = config.getini("doctest_optionflags")
E   AttributeError: 'SphinxDoctestModule' object has no attribute 'getini'

I'm not very familiar with what's changed in pytest 8, but I did find that the https://docs.pytest.org/en/stable/changelog.html#other-breaking-changes docs mention config.getini where they talk about a breaking change to parser.addini, in case that's a clue.

twmr commented 9 months ago

Thx for the report @jab! The unit-tests now pass again with the fixes from #59. Please let me now if there any further issues with pytest8, that were not detected by the unit-tests.

jab commented 9 months ago

LGTM, thanks @thisch!