-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Update to hypothesis 4.4.3 #1
Conversation
1436a15
to
4ddd279
Compare
Codecov Report
@@ Coverage Diff @@
## master #1 +/- ##
==========================================
+ Coverage 89.69% 95.83% +6.13%
==========================================
Files 5 5
Lines 262 288 +26
Branches 35 33 -2
==========================================
+ Hits 235 276 +41
+ Misses 16 8 -8
+ Partials 11 4 -7
|
bfa3300
to
159dab2
Compare
159dab2
to
cbe51e6
Compare
Hi all, Hypothesis maintainer here 😄 The idea of adding async state machines has come up before, e.g. in HypothesisWorks/hypothesis#1709, but we don't have the bandwidth or expertise to maintain a general-purpose or generic async stateful testing framework. More importantly, every test case must be deterministic for Hypothesis to really work. That means task scheduling and IO timing/chunking need to be deterministic, and ideally Hypothesis would control the IO part too (see python-trio/trio#239 for more thoughts). hypothesis-trio doesn't manage this currently, though I've been working on the scheduler story for a while now and getting close. (without that, the call order of async methods is not reliably related to the execution order and Hypothesis can't do much) I haven't heard reports of hypothesis-trio being broken though, so I guess it's mostly working in practice? Pinning Suggestions:
|
Hi @Zac-HD, thank you for your work :)
Well, this commit got rid of
Well, the problem here is that I had to copy-paste the full So let's say you fix some bug or behavior in this function and release hypothesis 4.4.4. Then consider a user with an environment including I guess we could get rid of the monkey-patching code, but it would still be weird for a user to not benefit for a fix that has been advertised in the hypothesis changelog. That's why I thought strict pinning was the lesser of two evils, until someone tackles the HypothesisWorks/hypothesis#1709 issue.
[edit] |
cbe51e6
to
aa43cfb
Compare
aa43cfb
to
6480601
Compare
I think we can get a decent compromise: def run_state_machine_as_test_patched(state_machine_factory, settings=None):
if issubclass(state_machine_factory, TrioRuleBasedStateMachine):
run_trio_state_machine_as_test(state_machine_factory, settings=settings)
original_run_state_machine_as_test(state_machine_factory, settings=settings)
# And to replace the current monkeypatching...
original_run_state_machine_as_test = hypothesis.stateful.run_state_machine_as_test
hypothesis.stateful.run_state_machine_as_test = run_state_machine_as_test_patched This allows the latest Hypothesis features to be used for everything except TrioRuleBasedStateMachines, which will be pinned to whatever they got copy-pasted out of. |
Alright I'll change that then, and add |
@Zac-HD I just realized your suggestion breaks the following use case: my_machine = MyTrioStateMachine(*some_custom_args)
run_state_machine_as_test(lambda: my_machine) Maybe a better solution is simply to remove the monkey patching and let user choose between Or make it even more explicit by getting rid of the state machine detection and exposing |
Does that use-case come up often? Calling I think we need the monkeypatching to make the |
6480601
to
577eadd
Compare
12154a9
to
85e5898
Compare
9ca3a9a
to
87db684
Compare
We have to, since the stateful module relies on a dangerous copy-paste
87db684
to
d2561e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR is a great improvement on the status quo, a fantastic first contributionm, and a solid 0.3 release. Thanks so much Vincent!
@njsmith can you cut a release for us? Thanks 😄 |
@vxgmichel @Zac-HD version 0.3.0 has been released \o/ |
Thanks to all involved! |
... and bump version 0.3.0.