diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-07-14 22:04:32 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-07-14 22:15:44 +0300 |
commit | f63c01054b2468457365559bc0bb59a9db71c516 (patch) | |
tree | 7be7b5429934218d9dfd66d9a3b8b3729f912d95 | |
parent | 87dedb280d7f2cafc4e75dd63d0759f4352531b9 (diff) | |
download | ydb-f63c01054b2468457365559bc0bb59a9db71c516.tar.gz |
Intermediate changes
9 files changed, 43 insertions, 18 deletions
diff --git a/contrib/python/hypothesis/py3/.dist-info/METADATA b/contrib/python/hypothesis/py3/.dist-info/METADATA index 71e941b0c8..310e5a5007 100644 --- a/contrib/python/hypothesis/py3/.dist-info/METADATA +++ b/contrib/python/hypothesis/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: hypothesis -Version: 6.104.1 +Version: 6.104.2 Summary: A library for property-based testing Home-page: https://hypothesis.works Author: David R. MacIver and Zac Hatfield-Dodds diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py index 64885793fa..7d1e010a6e 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py @@ -1211,7 +1211,7 @@ class PrimitiveProvider(abc.ABC): def __init__(self, conjecturedata: Optional["ConjectureData"], /) -> None: self._cd = conjecturedata - def post_test_case_hook(self, value): + def post_test_case_hook(self, value: IRType) -> IRType: # hook for providers to modify values returned by draw_* after a full # test case concludes. Originally exposed for crosshair to reify its # symbolic values into actual values. @@ -1966,7 +1966,9 @@ class ConjectureData: self.max_depth = 0 self.has_discards = False - self.provider = provider(self) if isinstance(provider, type) else provider + self.provider: PrimitiveProvider = ( + provider(self) if isinstance(provider, type) else provider + ) assert isinstance(self.provider, PrimitiveProvider) self.__result: "Optional[ConjectureResult]" = None diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py index f1d29191ba..eb326f59a5 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py @@ -38,7 +38,7 @@ import attr from hypothesis import HealthCheck, Phase, Verbosity, settings as Settings from hypothesis._settings import local_settings from hypothesis.database import ExampleDatabase -from hypothesis.errors import InvalidArgument, StopTest +from hypothesis.errors import Flaky, HypothesisException, InvalidArgument, StopTest from hypothesis.internal.cache import LRUReusedCache from hypothesis.internal.compat import ( NotRequired, @@ -453,6 +453,24 @@ class ConjectureRunner: ), } self.stats_per_test_case.append(call_stats) + if self.settings.backend != "hypothesis": + for node in data.examples.ir_tree_nodes: + value = data.provider.post_test_case_hook(node.value) + expected_type = { + "string": str, + "float": float, + "integer": int, + "boolean": bool, + "bytes": bytes, + }[node.ir_type] + if type(value) is not expected_type: + raise HypothesisException( + f"expected {expected_type} from " + f"{data.provider.post_test_case_hook.__qualname__}, " + f"got {type(value)} ({value!r})" + ) + node.value = value + self._cache(data) if data.invalid_at is not None: # pragma: no branch # coverage bug? self.misaligned_count += 1 @@ -496,18 +514,23 @@ class ConjectureRunner: if data.status == Status.INTERESTING: if self.settings.backend != "hypothesis": - for node in data.examples.ir_tree_nodes: - value = data.provider.post_test_case_hook(node.value) - # require providers to return something valid here. - assert ( - value is not None - ), "providers must return a non-null value from post_test_case_hook" - node.value = value - # drive the ir tree through the test function to convert it # to a buffer + initial_origin = data.interesting_origin data = ConjectureData.for_ir_tree(data.examples.ir_tree_nodes) self.__stoppable_test_function(data) + data.freeze() + # we'd like to use expected_failure machinery here from + # StateForActualGivenExecution for better diagnostic reports of eg + # flaky deadlines, but we're too low down in the engine for that. + # for now a worse generic flaky error will have to do. + if data.status != Status.INTERESTING: + raise Flaky( + f"Inconsistent results from replaying a failing test case!\n" + f" last: {Status.INTERESTING.name} from {initial_origin}\n" + f" this: {data.status.name}" + ) + self._cache(data) key = data.interesting_origin diff --git a/contrib/python/hypothesis/py3/hypothesis/version.py b/contrib/python/hypothesis/py3/hypothesis/version.py index ec253b11e5..5259509771 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, 104, 1) +__version_info__ = (6, 104, 2) __version__ = ".".join(map(str, __version_info__)) diff --git a/contrib/python/hypothesis/py3/ya.make b/contrib/python/hypothesis/py3/ya.make index 1999325709..3e32db3afa 100644 --- a/contrib/python/hypothesis/py3/ya.make +++ b/contrib/python/hypothesis/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(6.104.1) +VERSION(6.104.2) LICENSE(MPL-2.0) diff --git a/yt/yt/library/profiling/solomon/exporter.cpp b/yt/yt/library/profiling/solomon/exporter.cpp index d0273b970e..ec8d3c8bb7 100644 --- a/yt/yt/library/profiling/solomon/exporter.cpp +++ b/yt/yt/library/profiling/solomon/exporter.cpp @@ -39,7 +39,7 @@ using namespace NLogging; //////////////////////////////////////////////////////////////////////////////// -const static auto& Logger = SolomonLogger; +static constexpr auto& Logger = SolomonLogger; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/profiling/solomon/producer.cpp b/yt/yt/library/profiling/solomon/producer.cpp index 05072800b9..a6066a09d1 100644 --- a/yt/yt/library/profiling/solomon/producer.cpp +++ b/yt/yt/library/profiling/solomon/producer.cpp @@ -18,7 +18,7 @@ DEFINE_REFCOUNTED_TYPE(TProducerCounters) //////////////////////////////////////////////////////////////////////////////// -const static auto& Logger = SolomonLogger; +static constexpr auto& Logger = SolomonLogger; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/profiling/solomon/sensor_service.cpp b/yt/yt/library/profiling/solomon/sensor_service.cpp index 94520feb80..a5bb35f357 100644 --- a/yt/yt/library/profiling/solomon/sensor_service.cpp +++ b/yt/yt/library/profiling/solomon/sensor_service.cpp @@ -19,7 +19,7 @@ using namespace NYTree; //////////////////////////////////////////////////////////////////////////////// -const static auto& Logger = SolomonLogger; +static constexpr auto& Logger = SolomonLogger; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/profiling/solomon/sensor_set.cpp b/yt/yt/library/profiling/solomon/sensor_set.cpp index 5c857061ff..756d7b8b30 100644 --- a/yt/yt/library/profiling/solomon/sensor_set.cpp +++ b/yt/yt/library/profiling/solomon/sensor_set.cpp @@ -13,7 +13,7 @@ using namespace NYTree; //////////////////////////////////////////////////////////////////////////////// -const static auto& Logger = SolomonLogger; +static constexpr auto& Logger = SolomonLogger; //////////////////////////////////////////////////////////////////////////////// |