summaryrefslogtreecommitdiffstats
path: root/contrib/python/hypothesis
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-12-19 20:34:48 +0300
committerrobot-piglet <[email protected]>2025-12-19 20:50:32 +0300
commit1d30b0c3aaf7927031b8fe941da8a1284ae9850e (patch)
tree6432a2ffa733ff8f5edfc44135025905e0d19474 /contrib/python/hypothesis
parent42760c5456319a49128406ac1aed213da27009c1 (diff)
Intermediate changes
commit_hash:87c0b7af329135c61d1deec3de9870602d526a01
Diffstat (limited to 'contrib/python/hypothesis')
-rw-r--r--contrib/python/hypothesis/py3/.dist-info/METADATA6
-rw-r--r--contrib/python/hypothesis/py3/hypothesis/control.py20
-rw-r--r--contrib/python/hypothesis/py3/hypothesis/core.py15
-rw-r--r--contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py6
-rw-r--r--contrib/python/hypothesis/py3/hypothesis/version.py2
-rw-r--r--contrib/python/hypothesis/py3/ya.make2
6 files changed, 35 insertions, 16 deletions
diff --git a/contrib/python/hypothesis/py3/.dist-info/METADATA b/contrib/python/hypothesis/py3/.dist-info/METADATA
index bdce51b3b1b..a93de1df8c0 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.5
+Version: 6.148.6
Summary: The property-based testing library for Python
Author-email: "David R. MacIver and Zac Hatfield-Dodds" <[email protected]>
License-Expression: MPL-2.0
@@ -61,7 +61,7 @@ Provides-Extra: redis
Requires-Dist: redis>=3.0.0; extra == "redis"
Provides-Extra: crosshair
Requires-Dist: hypothesis-crosshair>=0.0.26; extra == "crosshair"
-Requires-Dist: crosshair-tool>=0.0.98; extra == "crosshair"
+Requires-Dist: crosshair-tool>=0.0.99; extra == "crosshair"
Provides-Extra: zoneinfo
Requires-Dist: tzdata>=2025.2; (sys_platform == "win32" or sys_platform == "emscripten") and extra == "zoneinfo"
Provides-Extra: django
@@ -71,7 +71,7 @@ Requires-Dist: watchdog>=4.0.0; extra == "watchdog"
Provides-Extra: all
Requires-Dist: black>=20.8b0; extra == "all"
Requires-Dist: click>=7.0; extra == "all"
-Requires-Dist: crosshair-tool>=0.0.98; extra == "all"
+Requires-Dist: crosshair-tool>=0.0.99; extra == "all"
Requires-Dist: django>=4.2; extra == "all"
Requires-Dist: dpcontracts>=0.4; extra == "all"
Requires-Dist: hypothesis-crosshair>=0.0.26; extra == "all"
diff --git a/contrib/python/hypothesis/py3/hypothesis/control.py b/contrib/python/hypothesis/py3/hypothesis/control.py
index e08da3a5a57..11f82232311 100644
--- a/contrib/python/hypothesis/py3/hypothesis/control.py
+++ b/contrib/python/hypothesis/py3/hypothesis/control.py
@@ -254,22 +254,34 @@ def event(value: str, payload: str | int | float = "") -> None:
"""
context = _current_build_context.value
if context is None:
- raise InvalidArgument("Cannot make record events outside of a test")
+ raise InvalidArgument("Cannot record events outside of a test")
- payload = _event_to_string(payload, (str, int, float))
- context.data.events[_event_to_string(value)] = payload
+ avoid_realization = context.data.provider.avoid_realization
+ payload = _event_to_string(
+ payload, allowed_types=(str, int, float), avoid_realization=avoid_realization
+ )
+ value = _event_to_string(value, avoid_realization=avoid_realization)
+ context.data.events[value] = payload
_events_to_strings: WeakKeyDictionary = WeakKeyDictionary()
-def _event_to_string(event, allowed_types=str):
+def _event_to_string(event, *, allowed_types=str, avoid_realization):
if isinstance(event, allowed_types):
return event
+
+ # _events_to_strings is a cache which persists across iterations, causing
+ # problems for symbolic backends. see
+ # https://github.com/pschanely/hypothesis-crosshair/issues/41
+ if avoid_realization:
+ return str(event)
+
try:
return _events_to_strings[event]
except (KeyError, TypeError):
pass
+
result = str(event)
try:
_events_to_strings[event] = result
diff --git a/contrib/python/hypothesis/py3/hypothesis/core.py b/contrib/python/hypothesis/py3/hypothesis/core.py
index da214737993..e0d02ab7701 100644
--- a/contrib/python/hypothesis/py3/hypothesis/core.py
+++ b/contrib/python/hypothesis/py3/hypothesis/core.py
@@ -1292,6 +1292,16 @@ class StateForActualGivenExecution:
finally:
# Conditional here so we can save some time constructing the payload; in
# other cases (without coverage) it's cheap enough to do that regardless.
+ #
+ # Note that we have to unconditionally realize data.events, because
+ # the statistics reported by the pytest plugin use a different flow
+ # than observability, but still access symbolic events.
+
+ try:
+ data.events = data.provider.realize(data.events)
+ except BackendCannotProceed:
+ data.events = {}
+
if observability_enabled():
if runner := getattr(self, "_runner", None):
phase = runner._current_phase
@@ -1316,11 +1326,6 @@ class StateForActualGivenExecution:
except BackendCannotProceed:
self._string_repr = "<backend failed to realize symbolic arguments>"
- try:
- data.events = data.provider.realize(data.events)
- except BackendCannotProceed:
- data.events = {}
-
data.freeze()
tc = make_testcase(
run_start=self._start_timestamp,
diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py
index 7af61ac6045..21ea97c7c5c 100644
--- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py
+++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py
@@ -563,6 +563,10 @@ class ConjectureRunner:
if not interrupted: # pragma: no branch
assert data.cannot_proceed_scope is None
data.freeze()
+
+ if self.settings.backend != "hypothesis":
+ realize_choices(data, for_failure=data.status is Status.INTERESTING)
+
call_stats: CallStats = {
"status": data.status.name.lower(),
"runtime": data.finish_time - data.start_time,
@@ -573,8 +577,6 @@ class ConjectureRunner:
),
}
self.stats_per_test_case.append(call_stats)
- if self.settings.backend != "hypothesis":
- realize_choices(data, for_failure=data.status is Status.INTERESTING)
self._cache(data)
if data.misaligned_at is not None: # pragma: no branch # coverage bug?
diff --git a/contrib/python/hypothesis/py3/hypothesis/version.py b/contrib/python/hypothesis/py3/hypothesis/version.py
index 575a16dbe7a..477c8a8b51a 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, 5)
+__version_info__ = (6, 148, 6)
__version__ = ".".join(map(str, __version_info__))
diff --git a/contrib/python/hypothesis/py3/ya.make b/contrib/python/hypothesis/py3/ya.make
index 0e1c9af46c1..700515dc59a 100644
--- a/contrib/python/hypothesis/py3/ya.make
+++ b/contrib/python/hypothesis/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(6.148.5)
+VERSION(6.148.6)
LICENSE(MPL-2.0)