Disable features without required Redis modules
Some features, like querying and embedded models, require either the RediSearch or RedisJSON modules running in Redis. Without these modules, using these features would result in inscrutable errors. We now disable some tests if the Redis module required for the test is not found in the Redis instance the tests are using, and raise errors or log messages if the same is true during execution of HashModel and JsonModel.
This commit is contained in:
parent
ca48b222f3
commit
2b1994b98b
8 changed files with 269 additions and 10 deletions
|
|
@ -8,11 +8,15 @@ from unittest import mock
|
|||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from redis_om.checks import has_redis_json
|
||||
from redis_om.model import EmbeddedJsonModel, Field, JsonModel
|
||||
from redis_om.model.migrations.migrator import Migrator
|
||||
from redis_om.model.model import NotFoundError, QueryNotSupportedError, RedisModelError
|
||||
|
||||
|
||||
if not has_redis_json():
|
||||
pytestmark = pytest.mark.skip
|
||||
|
||||
today = datetime.date.today()
|
||||
|
||||
|
||||
|
|
@ -477,7 +481,7 @@ def test_numeric_queries(members, m):
|
|||
actual = m.Member.find(m.Member.age == 34).all()
|
||||
assert actual == [member2]
|
||||
|
||||
actual = m.Member.find(m.Member.age > 34).all()
|
||||
actual = m.Member.find(m.Member.age > 34).sort_by("age").all()
|
||||
assert actual == [member1, member3]
|
||||
|
||||
actual = m.Member.find(m.Member.age < 35).all()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue