mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-30 03:00:41 -04:00
disable caching during tests
This commit is contained in:
@@ -8,6 +8,9 @@ from backend.util.logging import configure_logging
|
||||
|
||||
load_dotenv()
|
||||
|
||||
# Disable caching during tests to avoid test interference
|
||||
os.environ["DISABLE_CACHE_IN_TESTS"] = "true"
|
||||
|
||||
# NOTE: You can run tests like with the --log-cli-level=INFO to see the logs
|
||||
# Set up logging
|
||||
configure_logging()
|
||||
|
||||
@@ -10,6 +10,7 @@ import functools
|
||||
import hashlib
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from json import loads
|
||||
from typing import Any, Callable, Dict, Optional
|
||||
|
||||
@@ -141,6 +142,10 @@ def ttl_cache(
|
||||
def decorator(func: Callable) -> Callable:
|
||||
@functools.wraps(func)
|
||||
async def async_wrapper(*args, **kwargs):
|
||||
# Disable caching during tests to avoid test interference
|
||||
if os.environ.get("DISABLE_CACHE_IN_TESTS") == "true":
|
||||
return await func(*args, **kwargs)
|
||||
|
||||
# Lazy cache resolution to avoid initialization issues
|
||||
if cache_instance:
|
||||
cache = cache_instance
|
||||
|
||||
Reference in New Issue
Block a user