diff --git a/changelog/13038.doc.rst b/changelog/13038.doc.rst new file mode 100644 index 00000000000..b04ae1b807c --- /dev/null +++ b/changelog/13038.doc.rst @@ -0,0 +1 @@ +Document that doctests do not support parametrized fixtures, including parametrized autouse fixtures. diff --git a/doc/en/how-to/doctest.rst b/doc/en/how-to/doctest.rst index 59d1033ed4f..9bbe750bc4a 100644 --- a/doc/en/how-to/doctest.rst +++ b/doc/en/how-to/doctest.rst @@ -224,6 +224,12 @@ unless explicitly configured by :confval:`python_files`. Also, the :ref:`usefixtures ` mark and fixtures marked as :ref:`autouse ` are supported when executing text doctest files. +Doctests do not support fixtures that depend on parametrization, because doctest +collection does not perform the same test generation as normal test functions. +This includes parametrized autouse fixtures. If you need to run doctests against +multiple backends or configurations, consider moving those checks into normal +test functions or a dedicated doctest plugin. + .. _`doctest_namespace`: