ward icon indicating copy to clipboard operation
ward copied to clipboard

Supporting Hypothesis tests

Open darrenburns opened this issue 3 years ago • 2 comments

I'd like to re-examine this. It was an early goal of Ward that was dropped. It's actually the reason the @using decorator exists!

Ideally we could write tests like:

@given(text())
@using(fix=some_fixture)  # this already exists
@test("the test description")
def _(some_text, fix):
    ...

or perhaps the following, if possible...

@using(some_text=text(), fix=some_fixture) 
@test("the test description")
def _(some_text, fix):
    ...

Examining the code here could be useful: https://github.com/HypothesisWorks/hypothesis/blob/master/hypothesis-python/src/hypothesis/extra/pytestplugin.py#L139

darrenburns avatar Jun 05 '21 17:06 darrenburns

I would be keen on having this. I really like the way ward does parameterized testing and would like to combine that with hypothesis.

taybenlor avatar Jul 26 '21 05:07 taybenlor

@darrenburns Are there any updates on this? I was thinking of using ward and hypothesis for testing one of my own packages, and saw that this issue is still open. It would be really nice to have support for this 😁 ! PS: The code for hypothesis's pytest plugin has moved here, if anyone wants to have a look at it.

astrogewgaw avatar Oct 09 '22 19:10 astrogewgaw