Skip to content

Commit f0ac7fb

Browse files
fix redis_url usage in tests
1 parent af5c62b commit f0ac7fb

File tree

5 files changed

+26
-22
lines changed

5 files changed

+26
-22
lines changed

tests/integration/test_connection.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
EXPECTED_LIB_NAME = f"redis-py(redisvl_v{__version__})"
2121

2222

23-
def test_get_address_from_env(redis_url):
24-
assert get_address_from_env() == redis_url
25-
26-
2723
def test_unpack_redis_modules():
2824
module_list = [
2925
{

tests/integration/test_llmcache.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -894,33 +894,35 @@ def test_bad_dtype_connecting_to_existing_cache(redis_url):
894894
)
895895

896896

897-
def test_vectorizer_dtype_mismatch():
897+
def test_vectorizer_dtype_mismatch(redis_url):
898898
with pytest.raises(ValueError):
899899
SemanticCache(
900900
name="test_dtype_mismatch",
901901
dtype="float32",
902902
vectorizer=HFTextVectorizer(dtype="float16"),
903+
redis_url=redis_url,
903904
overwrite=True,
904905
)
905906

906907

907-
def test_invalid_vectorizer():
908+
def test_invalid_vectorizer(redis_url):
908909
with pytest.raises(TypeError):
909910
SemanticCache(
910911
name="test_invalid_vectorizer",
911912
vectorizer="invalid_vectorizer", # type: ignore
913+
redis_url=redis_url,
912914
overwrite=True,
913915
)
914916

915917

916-
def test_passes_through_dtype_to_default_vectorizer():
918+
def test_passes_through_dtype_to_default_vectorizer(redis_url):
917919
# The default is float32, so we should see float64 if we pass it in.
918920
cache = SemanticCache(
919-
name="test_pass_through_dtype", dtype="float64", overwrite=True
921+
name="test_pass_through_dtype", dtype="float64", redis_url=redis_url, overwrite=True
920922
)
921923
assert cache._vectorizer.dtype == "float64"
922924

923925

924-
def test_deprecated_dtype_argument():
926+
def test_deprecated_dtype_argument(redis_url):
925927
with pytest.warns(DeprecationWarning):
926-
SemanticCache(name="test_deprecated_dtype", dtype="float32", overwrite=True)
928+
SemanticCache(name="test_deprecated_dtype", dtype="float32", redis_url=redis_url, overwrite=True)

tests/integration/test_search_results.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def filter_query():
1616

1717

1818
@pytest.fixture
19-
def index(sample_data):
19+
def index(sample_data, redis_url):
2020
fields_spec = [
2121
{"name": "credit_score", "type": "tag"},
2222
{"name": "user", "type": "tag"},
@@ -47,7 +47,7 @@ def index(sample_data):
4747
index = SearchIndex.from_dict(json_schema)
4848

4949
# connect to local redis instance
50-
index.connect(os.environ["REDIS_URL"])
50+
index.connect(redis_url=redis_url)
5151

5252
# create the index (no data yet)
5353
index.create(overwrite=True)

tests/integration/test_semantic_router.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,42 +315,46 @@ def test_bad_dtype_connecting_to_exiting_router(redis_url, routes):
315315
)
316316

317317

318-
def test_vectorizer_dtype_mismatch(routes):
318+
def test_vectorizer_dtype_mismatch(routes, redis_url):
319319
with pytest.raises(ValueError):
320320
SemanticRouter(
321321
name="test_dtype_mismatch",
322322
routes=routes,
323323
dtype="float32",
324324
vectorizer=HFTextVectorizer(dtype="float16"),
325+
redis_url=redis_url,
325326
overwrite=True,
326327
)
327328

328329

329-
def test_invalid_vectorizer(routes):
330+
def test_invalid_vectorizer(routes, redis_url):
330331
with pytest.raises(TypeError):
331332
SemanticRouter(
332333
name="test_invalid_vectorizer",
333334
vectorizer="invalid_vectorizer", # type: ignore
335+
redis_url=redis_url,
334336
overwrite=True,
335337
)
336338

337339

338-
def test_passes_through_dtype_to_default_vectorizer(routes):
340+
def test_passes_through_dtype_to_default_vectorizer(routes, redis_url):
339341
# The default is float32, so we should see float64 if we pass it in.
340342
router = SemanticRouter(
341343
name="test_pass_through_dtype",
342344
routes=routes,
343345
dtype="float64",
346+
redis_url=redis_url,
344347
overwrite=True,
345348
)
346349
assert router.vectorizer.dtype == "float64"
347350

348351

349-
def test_deprecated_dtype_argument(routes):
352+
def test_deprecated_dtype_argument(routes, redis_url):
350353
with pytest.warns(DeprecationWarning):
351354
SemanticRouter(
352355
name="test_deprecated_dtype",
353356
routes=routes,
354357
dtype="float32",
358+
redis_url=redis_url,
355359
overwrite=True,
356360
)

tests/integration/test_session_manager.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -589,33 +589,35 @@ def test_bad_dtype_connecting_to_exiting_session(redis_url):
589589
)
590590

591591

592-
def test_vectorizer_dtype_mismatch():
592+
def test_vectorizer_dtype_mismatch(redis_url):
593593
with pytest.raises(ValueError):
594594
SemanticSessionManager(
595595
name="test_dtype_mismatch",
596596
dtype="float32",
597597
vectorizer=HFTextVectorizer(dtype="float16"),
598+
redis_url=redis_url,
598599
overwrite=True,
599600
)
600601

601602

602-
def test_invalid_vectorizer():
603+
def test_invalid_vectorizer(redis_url):
603604
with pytest.raises(TypeError):
604605
SemanticSessionManager(
605606
name="test_invalid_vectorizer",
606607
vectorizer="invalid_vectorizer", # type: ignore
608+
redis_url=redis_url,
607609
overwrite=True,
608610
)
609611

610612

611-
def test_passes_through_dtype_to_default_vectorizer():
613+
def test_passes_through_dtype_to_default_vectorizer(redis_url):
612614
# The default is float32, so we should see float64 if we pass it in.
613615
cache = SemanticSessionManager(
614-
name="test_pass_through_dtype", dtype="float64", overwrite=True
616+
name="test_pass_through_dtype", dtype="float64", redis_url=redis_url, overwrite=True
615617
)
616618
assert cache._vectorizer.dtype == "float64"
617619

618620

619-
def test_deprecated_dtype_argument():
621+
def test_deprecated_dtype_argument(redis_url):
620622
with pytest.warns(DeprecationWarning):
621-
SemanticSessionManager(name="float64 session", dtype="float64", overwrite=True)
623+
SemanticSessionManager(name="float64 session", dtype="float64", redis_url=redis_url, overwrite=True)

0 commit comments

Comments
 (0)