From 20b60d57f27d10c60c90cf27503eb009f43a92f5 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 7 Feb 2023 16:50:13 +0100 Subject: [PATCH] Add lru cache to loading fixtures in tests (#87634) --- tests/common.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/common.py b/tests/common.py index 14897da9f12..717e6fdd2d9 100644 --- a/tests/common.py +++ b/tests/common.py @@ -7,6 +7,7 @@ from collections.abc import Awaitable, Callable, Collection, Mapping, Sequence from contextlib import contextmanager from datetime import datetime, timedelta, timezone import functools as ft +from functools import lru_cache from io import StringIO import json import logging @@ -502,6 +503,7 @@ def get_fixture_path(filename: str, integration: str | None = None) -> pathlib.P ) +@lru_cache def load_fixture(filename: str, integration: str | None = None) -> str: """Load a fixture.""" return get_fixture_path(filename, integration).read_text()