v4.1.0 #189
@ -2,5 +2,14 @@
|
|||||||
"locale": "en",
|
"locale": "en",
|
||||||
"bot": {
|
"bot": {
|
||||||
"bot_token": "sample_token"
|
"bot_token": "sample_token"
|
||||||
|
},
|
||||||
|
"cache": {
|
||||||
|
"type": "memcached",
|
||||||
|
"memcached": {
|
||||||
|
"uri": "127.0.0.1:11211"
|
||||||
|
},
|
||||||
|
"redis": {
|
||||||
|
"uri": "redis://127.0.0.1:6379/0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
28
tests/test_cache.py
Normal file
28
tests/test_cache.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
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)
|
5
tox.ini
5
tox.ini
@ -10,13 +10,14 @@ python =
|
|||||||
3.13: py313
|
3.13: py313
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
setenv =
|
setenv =
|
||||||
PYTHONPATH = {toxinidir}
|
PYTHONPATH = {toxinidir}
|
||||||
deps =
|
deps =
|
||||||
-r{toxinidir}/requirements/_.txt
|
-r{toxinidir}/requirements/_.txt
|
||||||
-r{toxinidir}/requirements/dev.txt
|
-r{toxinidir}/requirements/dev.txt
|
||||||
-r{toxinidir}/requirements/pycord.txt
|
-r{toxinidir}/requirements/pycord.txt
|
||||||
-r{toxinidir}/requirements/pyrogram.txt
|
-r{toxinidir}/requirements/pyrogram.txt
|
||||||
-r{toxinidir}/requirements/speed.txt
|
-r{toxinidir}/requirements/speed.txt
|
||||||
|
-r{toxinidir}/requirements/cache.txt
|
||||||
commands =
|
commands =
|
||||||
pytest --basetemp={envtmpdir} --cov=libbot
|
pytest --basetemp={envtmpdir} --cov=libbot
|
Loading…
x
Reference in New Issue
Block a user