Fixes using `pytest.xfail()` and `pytest.importorskip()` in doctests. Ref: https://github.com/pytest-dev/pytest/issues/310