pschanely / hypothesis-crosshair

Level-up your Hypothesis tests with CrossHair
MIT License
8 stars 0 forks source link

Crosshair takes significant time to generate valid examples for some strategies #16

Closed tybug closed 1 month ago

tybug commented 2 months ago

I'm seeing many related internal IgnoreAttempt raises here.

For instance:

@given(st.datetimes())
@settings(backend="crosshair", deadline=None)
def f(n):
    print("call")
f()

takes ~75 IgnoreAttempts over 5 seconds until it prints its first call.

Other offenders are st.dates() (not that bad) and st.emails().

This may not be surprising given crosshair is working with a low level IR, but I wonder if this could be alleviated in some way?

pschanely commented 2 months ago

Haven't forgotten about this! Will at least have a diagnostic response this weekend.

pschanely commented 1 month ago

Dates involve many bounded integers, so we have to make a bunch of decisions correctly to get a valid date; but there's some internal crosshair stuff I can do to force it to make certain decisions if possible, which helps a lot. Fixed in hypothesis-crosshair v0.0.10