Skip to content

Commit

Permalink
Moving the tests into the right test files
Browse files Browse the repository at this point in the history
  • Loading branch information
synedra committed Feb 28, 2024
1 parent a2b2fc6 commit b02b982
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
1 change: 1 addition & 0 deletions tests/idiomatic/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

TEST_COLLECTION_INSTANCE_NAME = "test_coll_instance"
TEST_COLLECTION_NAME = "id_test_collection"
TEST_CREATE_DELETE_VECTOR_COLLECTION_NAME = "ephemeral_v_col"

ASTRA_DB_SECONDARY_KEYSPACE = os.environ.get("ASTRA_DB_SECONDARY_KEYSPACE")

Expand Down
14 changes: 0 additions & 14 deletions tests/idiomatic/integration/test_collections_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

from astrapy import AsyncCollection, AsyncDatabase

TEST_CREATE_DELETE_VECTOR_COLLECTION_NAME = "ephemeral_v_col"
TEST_CREATE_DELETE_NONVECTOR_COLLECTION_NAME = "ephemeral_non_v_col"

class TestCollectionsAsync:
@pytest.mark.describe("test of instantiating Collection, async")
async def test_instantiate_collection_async(
Expand Down Expand Up @@ -76,17 +73,6 @@ async def test_collection_set_caller_async(
)
assert col1 == col2

@pytest.mark.describe("should create and destroy a vector collection using collection drop (async)")
async def test_create_destroy_collection(self, async_database: AsyncDatabase) -> None:
col = await async_database.create_collection(
name=TEST_CREATE_DELETE_VECTOR_COLLECTION_NAME, dimension=2
)
assert isinstance(col, AsyncCollection)
del_res = await col.drop(
TEST_CREATE_DELETE_VECTOR_COLLECTION_NAME
)
assert del_res["status"]["ok"] == 1

@pytest.mark.describe("test errors for unsupported Collection methods, async")
async def test_collection_unsupported_methods_async(
self,
Expand Down
13 changes: 12 additions & 1 deletion tests/idiomatic/integration/test_ddl_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import pytest

from ..conftest import ASTRA_DB_SECONDARY_KEYSPACE, TEST_COLLECTION_NAME
from ..conftest import ASTRA_DB_SECONDARY_KEYSPACE, TEST_COLLECTION_NAME, TEST_CREATE_DELETE_VECTOR_COLLECTION_NAME
from astrapy import AsyncCollection, AsyncDatabase


Expand All @@ -35,6 +35,17 @@ async def test_collection_lifecycle_async(
assert col1 == col2
await async_database.drop_collection(TEST_LOCAL_COLLECTION_NAME)

@pytest.mark.describe("should create and destroy a vector collection using collection drop (async)")
async def async_test_create_destroy_collection(self, async_database: AsyncDatabase) -> None:
col = await async_database.create_collection(
name="test_col_drop", dimension=2
)
assert isinstance(col, AsyncCollection)
del_res = await col.drop(
"test_col_drop"
)
assert del_res["status"]["ok"] == 1

@pytest.mark.describe("test of Database list_collections, async")
async def test_database_list_collections_async(
self,
Expand Down
15 changes: 13 additions & 2 deletions tests/idiomatic/integration/test_ddl_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@

import pytest

from ..conftest import ASTRA_DB_SECONDARY_KEYSPACE, TEST_COLLECTION_NAME
from ..conftest import ASTRA_DB_SECONDARY_KEYSPACE, TEST_COLLECTION_NAME, TEST_CREATE_DELETE_VECTOR_COLLECTION_NAME
from astrapy import Collection, Database


class TestDDLSync:
@pytest.mark.describe("test of collection creation, get, and then drop, sync")
def test_collection_lifecycle_sync(
Expand All @@ -35,6 +34,18 @@ def test_collection_lifecycle_sync(
assert col1 == col2
sync_database.drop_collection(TEST_LOCAL_COLLECTION_NAME)

@pytest.mark.describe("should create and destroy a vector collection using collection drop ")
def test_create_destroy_collection(self, sync_database: Database) -> None:
col = sync_database.create_collection(
name="TEST_CREATE_DELETE_VECTOR_COLLECTION_NAME", dimension=2
)
assert isinstance(col, Collection)
del_res = col.drop(
TEST_CREATE_DELETE_VECTOR_COLLECTION_NAME
)
assert del_res["status"]["ok"] == 1


@pytest.mark.describe("test of Database list_collections, sync")
def test_database_list_collections_sync(
self,
Expand Down

0 comments on commit b02b982

Please sign in to comment.