Skip to content

Commit

Permalink
Add AUTHORS.rst, RELEASE.rst, and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nickcollins authored and Zac-HD committed Sep 24, 2023
1 parent cc60f8c commit 94d1aed
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ their individual contributions.
* `Munir Abdinur <https://www.github.com/mabdinur>`_
* `Nicholas Chammas <https://www.github.com/nchammas>`_
* `Nick Anyos <https://www.github.com/NickAnyos>`_
* `Nick Collins <https://github.com/nickcollins>` _
* `Nick Muoh <https://github.com/OdinTech3>`_ ([email protected])
* `Nicolas Erni <https://www.github.com/ThunderKey>`_
* `Nikita Sobolev <https://github.com/sobolevn>`_ ([email protected])
Expand Down
5 changes: 5 additions & 0 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RELEASE_TYPE: minor

Deprecate use of :func:`~hypothesis.assume` and :func:`~hypothesis.reject`
outside of property-based tests, because these functions work by raising a
special exception (:issue:`3743`).
25 changes: 23 additions & 2 deletions hypothesis-python/tests/cover/test_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import pytest

from hypothesis import Verbosity, given, reporting, settings
from hypothesis import Verbosity, assume, given, reject, reporting, settings
from hypothesis.control import (
BuildContext,
_current_build_context,
Expand All @@ -20,7 +20,11 @@
event,
note,
)
from hypothesis.errors import InvalidArgument
from hypothesis.errors import (
HypothesisDeprecationWarning,
InvalidArgument,
UnsatisfiedAssumption,
)
from hypothesis.internal.compat import ExceptionGroup
from hypothesis.internal.conjecture.data import ConjectureData as TD
from hypothesis.stateful import RuleBasedStateMachine, rule
Expand Down Expand Up @@ -123,6 +127,23 @@ def test_raises_if_note_out_of_context():
note("Hi")


def test_deprecation_warning_if_assume_out_of_context():
with pytest.warns(
HypothesisDeprecationWarning,
match="Using `assume` outside a property-based test is deprecated",
):
assume(True)


def test_deprecation_warning_if_reject_out_of_context():
with pytest.warns(
HypothesisDeprecationWarning,
match="Using `reject` outside a property-based test is deprecated",
):
with pytest.raises(UnsatisfiedAssumption):
reject()


def test_raises_if_current_build_context_out_of_context():
with pytest.raises(InvalidArgument):
current_build_context()
Expand Down

0 comments on commit 94d1aed

Please sign in to comment.