The function makedocs supports the keyword argument doctestfilters.
This is a documented feature, and it works nicely when one runs the doctests as one step of processing the documentation.
However, if one wants to run the doctests by calling doctest in a @testset then doctestfilters seem to be not supported; doctest calls makedocs but does not supply keyword arguments such as doctestfilters.