With pytest dev (starting at: 46478fa) the following example passes with a default pytest run but errors if --doctest-modules is enabled.
import pytest
@pytest.fixture
def foo_fixture():
return 1
def test_foo(foo_fixture):
assert foo_fixture
The error is:
____________________________________________________________________________________________________________ ERROR at setup of test_foo _____________________________________________________________________________________________________________
file /projects/251117_pytest_dev/foo/test_foo.py, line 10
def test_foo(foo_fixture):
E fixture 'foo_fixture' not found
> available fixtures: _syrupy_apply_ide_patches, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, capteesys, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, snapshot, subtests, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/projects/251117_pytest_dev/foo/test_foo.py:10
The prior commit (543b11f) passes in with --doctest-modules.
pip list
Package Version Editable project location
----------------- ----------------------- ------------------------------------------------
aiohappyeyeballs 2.6.2
aiohttp 3.13.5
aiosignal 1.4.0
asdf 5.3.1.dev86+g71187c0fc /projects/251117_pytest_dev/asdf
asdf_standard 1.5.0
attrs 26.1.0
frozenlist 1.8.0
fsspec 2026.4.0
idna 3.17
iniconfig 2.3.0
jmespath 1.1.0
lz4 4.4.5
multidict 6.7.1
numpy 2.4.6
packaging 25.0
pip 24.0
pluggy 1.6.0
propcache 0.5.2
psutil 7.2.2
Pygments 2.19.2
pytest 9.1.0.dev386+g46478fad5 /projects/251117_pytest_dev/pytest
PyYAML 6.0.3
semantic-version 2.10.0
syrupy 5.2.0
typing_extensions 4.15.0
yarl 1.24.2
Tested with pytest dev (commits above) mac os.
- a detailed description of the bug or problem you are having
- output of pip list from the virtual environment you are using
- pytest and operating system versions
- minimal example if possible
Reactions are currently unavailable
With pytest dev (starting at: 46478fa) the following example passes with a default pytest run but errors if --doctest-modules is enabled.
The error is:
The prior commit (543b11f) passes in with --doctest-modules.
pip listTested with pytest dev (commits above) mac os.