Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: fix missing redis_url fixture in integration tests #249

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ docs/_build/
.venv
.env
coverage.xml
dist/
dist/
.vscode/settings.json
14 changes: 10 additions & 4 deletions tests/integration/test_llmcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,13 +868,19 @@ def test_create_cache_with_different_vector_types():
pytest.skip("Not using a late enough version of Redis")


def test_bad_dtype_connecting_to_existing_cache():
def test_bad_dtype_connecting_to_existing_cache(redis_url):
try:
cache = SemanticCache(name="float64_cache", dtype="float64")
same_type = SemanticCache(name="float64_cache", dtype="float64")
cache = SemanticCache(
name="float64_cache", dtype="float64", redis_url=redis_url
)
same_type = SemanticCache(
name="float64_cache", dtype="float64", redis_url=redis_url
)
# under the hood uses from_existing
except RedisModuleVersionError:
pytest.skip("Not using a late enough version of Redis")

with pytest.raises(ValueError):
bad_type = SemanticCache(name="float64_cache", dtype="float16")
bad_type = SemanticCache(
name="float64_cache", dtype="float16", redis_url=redis_url
)
11 changes: 9 additions & 2 deletions tests/integration/test_semantic_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,30 +241,34 @@ def test_bad_connection_info(routes):
)


def test_different_vector_dtypes(routes):
def test_different_vector_dtypes(redis_url, routes):
try:
bfloat_router = SemanticRouter(
name="bfloat_router",
routes=routes,
dtype="bfloat16",
redis_url=redis_url,
)

float16_router = SemanticRouter(
name="float16_router",
routes=routes,
dtype="float16",
redis_url=redis_url,
)

float32_router = SemanticRouter(
name="float32_router",
routes=routes,
dtype="float32",
redis_url=redis_url,
)

float64_router = SemanticRouter(
name="float64_router",
routes=routes,
dtype="float64",
redis_url=redis_url,
)

for router in [bfloat_router, float16_router, float32_router, float64_router]:
Expand All @@ -273,18 +277,20 @@ def test_different_vector_dtypes(routes):
pytest.skip("Not using a late enough version of Redis")


def test_bad_dtype_connecting_to_exiting_router(routes):
def test_bad_dtype_connecting_to_exiting_router(redis_url, routes):
try:
router = SemanticRouter(
name="float64 router",
routes=routes,
dtype="float64",
redis_url=redis_url,
)

same_type = SemanticRouter(
name="float64 router",
routes=routes,
dtype="float64",
redis_url=redis_url,
)
# under the hood uses from_existing
except RedisModuleVersionError:
Expand All @@ -295,4 +301,5 @@ def test_bad_dtype_connecting_to_exiting_router(routes):
name="float64 router",
routes=routes,
dtype="float16",
redis_url=redis_url,
)
14 changes: 10 additions & 4 deletions tests/integration/test_session_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,13 +563,19 @@ def test_different_vector_dtypes():
pytest.skip("Not using a late enough version of Redis")


def test_bad_dtype_connecting_to_exiting_session():
def test_bad_dtype_connecting_to_exiting_session(redis_url):
try:
session = SemanticSessionManager(name="float64 session", dtype="float64")
same_type = SemanticSessionManager(name="float64 session", dtype="float64")
session = SemanticSessionManager(
name="float64 session", dtype="float64", redis_url=redis_url
)
same_type = SemanticSessionManager(
name="float64 session", dtype="float64", redis_url=redis_url
)
# under the hood uses from_existing
except RedisModuleVersionError:
pytest.skip("Not using a late enough version of Redis")

with pytest.raises(ValueError):
bad_type = SemanticSessionManager(name="float64 session", dtype="float16")
bad_type = SemanticSessionManager(
name="float64 session", dtype="float16", redis_url=redis_url
)
Loading