-
Notifications
You must be signed in to change notification settings - Fork 589
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
Deprecate use of assume
or reject
outside of tests #3748
#3751
Deprecate use of assume
or reject
outside of tests #3748
#3751
Conversation
Some of the tests are failing, including at least one of the tests I wrote, but I don't know how to read the test output to see what is wrong. Is there a way I can run the tests without adding a commit and invoking the CI? |
You can click the "details" link next to the checks below this comment, which will lead e.g. here. You can run them locally with e.g. |
hypothesis-python/RELEASE.rst
Outdated
Deprecate use of :func:`~hypothesis.control.assume` and | ||
:func:`~hypothesis.control.reject` outside of tests. |
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.
Deprecate use of :func:`~hypothesis.control.assume` and | |
:func:`~hypothesis.control.reject` outside of tests. | |
Deprecate use of :func:`~hypothesis.assume` and :func:`~hypothesis.reject` from | |
outside a Hypothesis context, because these functions work by raising a special exception. |
important to note that it's not "outside a test", but outside a particular kind of test. I think it's worth explaining why, too, and would do both in the deprecation message.
If some code outside a test (e.g. `execute_example`) calls `assume` or `reject`, they raise `UnsatisfiedAssumption`, which is an internal exception that should generally not seen by user code. This commit provides a warning deprecating such use cases, which helps clarify to the user that they are getting the exception because they have called these functions from the wrong places.
...this has turned out to trigger some complicated latent issues in our engine, which are way more complicated than I anticipated. I'll push a commit to fix that, and then merge 🚀 |
fec0179
to
3a58f45
Compare
Ok, thanks! |
If some code outside a test (e.g.
execute_example
) callsassume
orreject
, they raiseUnsatisfiedAssumption
, which is an internal exception that should generally not seen by user code. This branch provides a warning deprecating such use cases, which helps clarify to the user that they are getting the exception because they have called these functions from the wrong places.A continuation of #3748 because I messed up the branch on that one and had to create a new branch.
Fixes #3743 and fixes #3753.