Document is_hypothesis_test#4354
Conversation
| To determine whether a test has been defined with Hypothesis or not, use |is_hypothesis_test|: | ||
|
|
There was a problem hiding this comment.
I'd want to add a note: if you're working with pytest, our [pytest plugin] automatically marks all such tests, so you can use node.get_closest_marker("hypothesis") rather than digging down to the callable.
There was a problem hiding this comment.
This is a not-found error:
:func:`node.get_closest_marker("hypothesis") <pytest:_pytest.nodes.Node.get_closest_marker>`
despite:
~/Desktop λ python -m sphinx.ext.intersphinx https://docs.pytest.org/en/stable/objects.inv | grep get_closest_marker
_pytest.nodes.Node.get_closest_marker : reference/reference.html#pytest.nodes.Node.get_closest_marker
~/Desktop λ
and I gave up after 10 minutes, so no nice get_closest_marker link :(
| .. |BackgroundWriteDatabase| replace:: :class:`~hypothesis.database.BackgroundWriteDatabase` | ||
| .. |RedisExampleDatabase| replace:: :class:`~hypothesis.extra.redis.RedisExampleDatabase` | ||
|
|
||
| .. |is_hypothesis_test| replace:: :func:`~hypothesis.is_hypothesis_test` |
There was a problem hiding this comment.
I think in this case I'd just inline the target definition here, since we're not referring it that often and it's not that much longer without custom link text. Does seem to be somewhere where we just have diverging taste though, and I don't mind you going with yours!
There was a problem hiding this comment.
My thought process is that in the future I don't want to have to think about what sphinx role to use (remember if it's called func or method), forget the tilde, etc. Maybe a skill issue on my end? I'm happy to admit this might be a personal crutch and that we shouldn't have a goal of |-references for every possible hypothesis object, though I weakly think it's a good thing.
Because this has a code interface, I put it in the API reference, instead of the Integrations reference.