As found over at astropy/astropy#18524, one can nicely insist that a given page should only be tested if a dependency is installed (e.g., using doctest_subpackage_requires = ... in pyproject.toml), but this only holds for the code in test cases, not for code in .. testsetup and .. testcleanup.
It would be lovely if those could be covered too!