I have a test for which I would like to disable the shrinking phase.
I can do this
from hypothesis import given, settings, strategies as st
from hypothesis._settings import Phase
@settings(report_multiple_bugs=False, phases=list(Phase)[:-1])
@given(my_composite_generator())
def test_legacy_rack_conversion(input):
assert_stuff_about(input)
but I don't like importing private things starting with an underscore from third-party libraries.
Is there a more recommended way to disable shrinking for a test?
See https://hypothesis.readthedocs.io/en/latest/settings.html#controlling-what-runs
Note that you should from hypothesis import Phase
, so there's no private API involved, but also that list(Phase)[:-1]
is incorrect - it skips the off-by-default explain phase, not shrinking. Better to explicitly list the phases you want.