From a013817920b4b94a09a532e4a5fec6f16df4045a Mon Sep 17 00:00:00 2001 From: Fabrice Normandin Date: Tue, 19 Nov 2024 19:24:42 +0000 Subject: [PATCH] Try to make tests faster Signed-off-by: Fabrice Normandin --- project/conftest.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/project/conftest.py b/project/conftest.py index 8398add7..b8bc9564 100644 --- a/project/conftest.py +++ b/project/conftest.py @@ -55,6 +55,7 @@ from __future__ import annotations import copy +import functools import operator import os import shlex @@ -81,6 +82,8 @@ from hydra import compose, initialize_config_module from hydra.conf import HydraHelpConf from hydra.core.hydra_config import HydraConfig +from hydra_plugins.auto_schema import auto_schema_plugin +from hydra_plugins.auto_schema.auto_schema_plugin import add_schemas_to_all_hydra_configs from omegaconf import DictConfig, open_dict from torch import Tensor from torch.utils.data import DataLoader @@ -115,6 +118,11 @@ DEFAULT_TIMEOUT = 1.0 DEFAULT_SEED = 42 +# Note: Here we attempt to make this happen only once. +auto_schema_plugin.add_schemas_to_all_hydra_configs = functools.cache( + add_schemas_to_all_hydra_configs +) + @pytest.fixture(autouse=True) def original_datadir(original_datadir: Path):