Skip to content

Commit

Permalink
linter/typechecker-friendly improvements to cassandra test (run-llama…
Browse files Browse the repository at this point in the history
  • Loading branch information
hemidactylus committed Sep 22, 2023
1 parent b48cdd3 commit 725026b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/vector_stores/test_cassandra.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@
from llama_index.vector_stores.cassandra import CassandraVectorStore

try:
import cassio
import cassio # noqa: F401

has_cassio = True
except ImportError:
cassio = None
has_cassio = False


class TestCassandraVectorStore(unittest.TestCase):
@pytest.mark.skipif(cassio is None, reason="cassio not installed")
@pytest.mark.skipif(not has_cassio, reason="cassio not installed")
def test_cassandra_create_and_crud(self) -> None:
mock_db_session = MagicMock()
try:
import cassio # noqa: F401
import cassio # noqa: F401, F811
except ModuleNotFoundError:
# mock `cassio` if not installed
mock_cassio = MagicMock()
Expand Down Expand Up @@ -51,11 +53,11 @@ def test_cassandra_create_and_crud(self) -> None:

vector_store.client

@pytest.mark.skipif(cassio is None, reason="cassio not installed")
@pytest.mark.skipif(not has_cassio, reason="cassio not installed")
def test_cassandra_queries(self) -> None:
mock_db_session = MagicMock()
try:
import cassio # noqa: F401
import cassio # noqa: F401, F811
except ModuleNotFoundError:
# mock `cassio` if not installed
mock_cassio = MagicMock()
Expand Down

0 comments on commit 725026b

Please sign in to comment.