Skip to content

Commit

Permalink
Fix hypothesis failure
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
holmanb authored Oct 19, 2023
1 parent 9a401b4 commit 14b76c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/unittests/early_patches.py
Original file line number Diff line number Diff line change
@@ -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__:
Expand Down

0 comments on commit 14b76c4

Please sign in to comment.