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

test: alter tests, skip tests, to be compatible with emulator #460

Merged
merged 9 commits into from
Sep 27, 2021
8 changes: 7 additions & 1 deletion tests/system/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
EMULATOR_CREDS,
FIRESTORE_EMULATOR,
)
import unittest


def _get_credentials_and_project():
Expand Down Expand Up @@ -922,6 +923,7 @@ def test_collection_group_queries_filters(client, cleanup):
assert found == set(["cg-doc2"])


@unittest.skipIf(FIRESTORE_EMULATOR, "PartitionQuery not implemented in emulator")
crwilcox marked this conversation as resolved.
Show resolved Hide resolved
def test_partition_query_no_partitions(client, cleanup):
collection_group = "b" + UNIQUE_RESOURCE_ID

Expand Down Expand Up @@ -953,6 +955,7 @@ def test_partition_query_no_partitions(client, cleanup):
assert found == expected


@unittest.skipIf(FIRESTORE_EMULATOR, "PartitionQuery not implemented in emulator")
def test_partition_query(client, cleanup):
collection_group = "b" + UNIQUE_RESOURCE_ID
n_docs = 128 * 2 + 127 # Minimum partition size is 128
Expand Down Expand Up @@ -1514,11 +1517,14 @@ def test_watch_query_order(client, cleanup):
# Setup listener
def on_snapshot(docs, changes, read_time):
try:
docs = [i for i in docs if i.id.endswith(UNIQUE_RESOURCE_ID)]
if len(docs) != 5:
return
# A snapshot should return the same thing as if a query ran now.
query_ran = query_ref.stream()
query_ran_results = [i for i in query_ran]
query_ran_results = [
i for i in query_ran if i.id.endswith(UNIQUE_RESOURCE_ID)
]
assert len(docs) == len(query_ran_results)

# compare the order things are returned
Expand Down
3 changes: 3 additions & 0 deletions tests/system/test_system_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
EMULATOR_CREDS,
FIRESTORE_EMULATOR,
)
import unittest

_test_event_loop = asyncio.new_event_loop()
pytestmark = pytest.mark.asyncio
Expand Down Expand Up @@ -917,6 +918,7 @@ async def test_collection_group_queries_filters(client, cleanup):
assert found == set(["cg-doc2"])


@unittest.skipIf(FIRESTORE_EMULATOR, "PartitionQuery not implemented in emulator")
async def test_partition_query_no_partitions(client, cleanup):
collection_group = "b" + UNIQUE_RESOURCE_ID

Expand Down Expand Up @@ -947,6 +949,7 @@ async def test_partition_query_no_partitions(client, cleanup):
assert found == expected


@unittest.skipIf(FIRESTORE_EMULATOR, "PartitionQuery not implemented in emulator")
async def test_partition_query(client, cleanup):
collection_group = "b" + UNIQUE_RESOURCE_ID
n_docs = 128 * 2 + 127 # Minimum partition size is 128
Expand Down