summaryrefslogtreecommitdiffstats
path: root/contrib/python/hypothesis
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/python/hypothesis')
-rw-r--r--contrib/python/hypothesis/py3/.dist-info/METADATA2
-rw-r--r--contrib/python/hypothesis/py3/hypothesis/errors.py7
-rw-r--r--contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strategies.py29
-rw-r--r--contrib/python/hypothesis/py3/hypothesis/version.py2
-rw-r--r--contrib/python/hypothesis/py3/ya.make2
5 files changed, 28 insertions, 14 deletions
diff --git a/contrib/python/hypothesis/py3/.dist-info/METADATA b/contrib/python/hypothesis/py3/.dist-info/METADATA
index 3cd9414ccc7..82a438e542b 100644
--- a/contrib/python/hypothesis/py3/.dist-info/METADATA
+++ b/contrib/python/hypothesis/py3/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.4
Name: hypothesis
-Version: 6.148.8
+Version: 6.148.9
Summary: The property-based testing library for Python
Author-email: "David R. MacIver and Zac Hatfield-Dodds" <[email protected]>
License-Expression: MPL-2.0
diff --git a/contrib/python/hypothesis/py3/hypothesis/errors.py b/contrib/python/hypothesis/py3/hypothesis/errors.py
index aed44680d8a..6cfabe6db96 100644
--- a/contrib/python/hypothesis/py3/hypothesis/errors.py
+++ b/contrib/python/hypothesis/py3/hypothesis/errors.py
@@ -188,8 +188,11 @@ class FailedHealthCheck(_Trimmable):
class NonInteractiveExampleWarning(HypothesisWarning):
- """SearchStrategy.example() is designed for interactive use,
- but should never be used in the body of a test.
+ """
+ Emitted when |.example| is used outside of interactive use.
+
+ |.example| is intended for exploratory and interactive work, not to be run as
+ part of a test suite.
"""
diff --git a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strategies.py b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strategies.py
index 0fd21ea108a..a9bf7393861 100644
--- a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strategies.py
+++ b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strategies.py
@@ -8,6 +8,7 @@
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
+import os
import sys
import threading
import warnings
@@ -301,9 +302,18 @@ class SearchStrategy(Generic[Ex]):
called from inside |@given| or a strategy definition. For serious use,
see |@composite| or |st.data|.
"""
- if getattr(sys, "ps1", None) is None: # pragma: no branch
- # The other branch *is* covered in cover/test_examples.py; but as that
- # uses `pexpect` for an interactive session `coverage` doesn't see it.
+ if getattr(sys, "ps1", None) is None and (
+ # The main module's __spec__ is None when running interactively
+ # or running a source file directly.
+ # See https://docs.python.org/3/reference/import.html#main-spec.
+ sys.modules["__main__"].__spec__ is not None
+ # __spec__ is also None under pytest-xdist. To avoid an unfortunate
+ # missed alarm here, always warn under pytest.
+ or os.environ.get("PYTEST_CURRENT_TEST") is not None
+ ): # pragma: no branch
+ # The other branch *is* covered in cover/test_interactive_example.py;
+ # but as that uses `pexpect` for an interactive session `coverage`
+ # doesn't see it.
warnings.warn(
"The `.example()` method is good for exploring strategies, but should "
"only be used interactively. We recommend using `@given` for tests - "
@@ -320,18 +330,19 @@ class SearchStrategy(Generic[Ex]):
"Using example() inside a strategy definition is a bad "
"idea. Instead consider using hypothesis.strategies.builds() "
"or @hypothesis.strategies.composite to define your strategy."
- " See https://hypothesis.readthedocs.io/en/latest/data.html"
- "#hypothesis.strategies.builds or "
- "https://hypothesis.readthedocs.io/en/latest/data.html"
- "#composite-strategies for more details."
+ " See https://hypothesis.readthedocs.io/en/latest/reference/"
+ "strategies.html#hypothesis.strategies.builds or "
+ "https://hypothesis.readthedocs.io/en/latest/reference/"
+ "strategies.html#hypothesis.strategies.composite for more "
+ "details."
)
else:
raise HypothesisException(
"Using example() inside a test function is a bad "
"idea. Instead consider using hypothesis.strategies.data() "
"to draw more examples during testing. See "
- "https://hypothesis.readthedocs.io/en/latest/data.html"
- "#drawing-interactively-in-tests for more details."
+ "https://hypothesis.readthedocs.io/en/latest/reference/"
+ "strategies.html#hypothesis.strategies.data for more details."
)
try:
diff --git a/contrib/python/hypothesis/py3/hypothesis/version.py b/contrib/python/hypothesis/py3/hypothesis/version.py
index 755ea0d3057..a85a584f267 100644
--- a/contrib/python/hypothesis/py3/hypothesis/version.py
+++ b/contrib/python/hypothesis/py3/hypothesis/version.py
@@ -8,5 +8,5 @@
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
-__version_info__ = (6, 148, 8)
+__version_info__ = (6, 148, 9)
__version__ = ".".join(map(str, __version_info__))
diff --git a/contrib/python/hypothesis/py3/ya.make b/contrib/python/hypothesis/py3/ya.make
index a895ac419fa..94e9856d5e7 100644
--- a/contrib/python/hypothesis/py3/ya.make
+++ b/contrib/python/hypothesis/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(6.148.8)
+VERSION(6.148.9)
LICENSE(MPL-2.0)