This question is basically the same as Python doctest: skip a test conditionally, except I'm not asking about Python's native doctest module but about Sphinx's doctest extension:
Is there any way to skip doctests "dynamically" depending on some condition, which could e.g. be evaluated in the setup code for the given reST file? The documentation doesn't mention anything of the sort, but maybe someone has a good workaround.
sphinx.ext.doctest. It already includes the pyversion option (e.g.:pyversion: > 3.3), and a conditional skip would work very similarly.doctest_global_setupconfiguration option would have been hard, since directives didn't have access to configuration.