Is it possible to mark doctests in pytest?

Viewed 67

I'd like to mark my doctests as unit tests (with a custom marker) so pytest -m unit runs all unit tests including doctests (without needing to specify --doctest-modules), but marking the enclosing function doesn't seem to do this, and nor does marking the entire module as containing unit tests. Is there a way to apply markers to doctests so they can be discovered and ran with pytest -m <marker>, and not run if the marker is not provided?

0 Answers
Related