From 14b76c4448e817570699421b27e234d60cf40bbb Mon Sep 17 00:00:00 2001 From: Brett Holman Date: Thu, 19 Oct 2023 16:39:37 -0600 Subject: [PATCH] Fix hypothesis failure The hypothesis test has been failing for some time. The root cause is the monkeypatching of lru_cache in tests, so this test fixes the failure. --- tests/unittests/early_patches.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/unittests/early_patches.py b/tests/unittests/early_patches.py index 8106c1b9efb..01b894d3e0a 100644 --- a/tests/unittests/early_patches.py +++ b/tests/unittests/early_patches.py @@ -1,12 +1,13 @@ import functools +from typing import Callable old_lru_cache = functools.lru_cache cached_functions = [] def wrapped_lru_cache(*args, **kwargs): - def wrapper(func): - new_func = old_lru_cache(*args, **kwargs)(func) + def wrapper(func: Callable, *a, **k): + new_func = old_lru_cache(*args, **kwargs)(func, *a, **k) # Without this check, we'll also store stdlib functions with @lru_cache if "cloudinit" in func.__module__: