Deprecate use of assume or reject outside of tests #3748#3751
Deprecate use of assume or reject outside of tests #3748#3751Zac-HD merged 11 commits intoHypothesisWorks:masterfrom
assume or reject outside of tests #3748#3751Conversation
|
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. |
| Deprecate use of :func:`~hypothesis.control.assume` and | ||
| :func:`~hypothesis.control.reject` outside of tests. No newline at end of file |
There was a problem hiding this comment.
| 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) callsassumeorreject, 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.