-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IndexError in OneOfStrategy.do_draw (intermittent) #1502
Comments
|
Using |
|
Travis tests are still at Python 3.4, but the problem is also in Python 3.6.6 as it is reproducible on my home machine. |
|
Huh. That definitely shouldn't be possible. I'm afraid I have zero time to investigate in the next week-ish. Happy to field questions if anyone else wants to though. My guess based on eye balling the code is that it's probably a bug in |
|
I have an example where The original strategy is: Anyone would think this could be obtained by calling: |
|
|
Is it possible that the error is coming from the strategy that generates those strategies rather than the strategy itself? |
|
I think we have the same idea. I'll try to follow it up some more tomorrow. |
|
Sorry, "tomorrow" has become "just as soon as I can manage". |
|
Hey, @mulkieran - I think I've tracked this down to a bug in |
|
Got it; this does indeed fix it. If the The minimal reproducer is simply Fix incoming! |
|
Ok! Thanks for finding this. |
You can see the trace in the Travis CI here: https://travis-ci.org/stratis-storage/hs-dbus-signature/jobs/418270565.
The source is available here: https://github.com/mulkieran/hs-dbus-signature/tree/master-hypothesis-2.
The interesting method is here: https://github.com/mulkieran/hs-dbus-signature/blob/master-hypothesis-2/tests/test_strategy.py#L107 and it is short but weird.
Essentially, I wrote a strategy for generating arbitrary instance of the strategy that this is testing. I draw from that strategy to get a strategy to test, and then I draw from the particular strategy being tested to try to demonstrate that every strategy will at least yield some values. The strategy itself is built using the recursive strategy, which explains the depth of the stack trace.
If there is a better way to test that any strategy will at least yield something please let me know.
If this index error is actually demonstrating that one strategy has been found that does not yield any elements that would be cool, too.
Occurs under coverage but also not under coverage, and not consistently under either, but always in OneOfStrategy.
Occurs when code is this as well
The text was updated successfully, but these errors were encountered: