LibBotUniversal/tests/test_cache.py
profitroll 12f7cb6365
All checks were successful
Analysis / SonarCloud (push) Successful in 42s
Analysis / SonarCloud (pull_request) Successful in 49s
Tests / Build and Test (3.11) (pull_request) Successful in 1m18s
Tests / Build and Test (3.12) (pull_request) Successful in 1m9s
Tests / Build and Test (3.13) (pull_request) Successful in 1m6s
Added some basic tests for Cache
2025-02-16 17:16:05 +01:00

29 lines
655 B
Python

from pathlib import Path
from libbot.cache.classes import Cache
from libbot.cache.manager import create_cache_client
try:
from ujson import JSONDecodeError, dumps, loads
except ImportError:
from json import JSONDecodeError, dumps, loads
from typing import Any, Dict
import pytest
@pytest.mark.parametrize(
"engine",
[
"memcached",
"redis",
],
)
def test_cache_creation(engine: str, location_config: Path):
with open(location_config, "r", encoding="utf-8") as file:
config: Dict[str, Any] = loads(file.read())
cache: Cache = create_cache_client(config, engine)
assert isinstance(cache, Cache)