Skip to content

Commit

Permalink
test: alter tests, skip tests, to be compatible with emulator (#460)
Browse files Browse the repository at this point in the history
* test: alter tests, skip tests, to be compatible with emulator
  • Loading branch information
crwilcox committed Sep 27, 2021
1 parent 0213e0c commit 1eb32e2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
11 changes: 10 additions & 1 deletion tests/system/test_system.py
Expand Up @@ -922,6 +922,9 @@ def test_collection_group_queries_filters(client, cleanup):
assert found == set(["cg-doc2"])


@pytest.mark.skipif(
FIRESTORE_EMULATOR, reason="PartitionQuery not implemented in emulator"
)
def test_partition_query_no_partitions(client, cleanup):
collection_group = "b" + UNIQUE_RESOURCE_ID

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


@pytest.mark.skipif(
FIRESTORE_EMULATOR, reason="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 +1520,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
6 changes: 6 additions & 0 deletions tests/system/test_system_async.py
Expand Up @@ -917,6 +917,9 @@ async def test_collection_group_queries_filters(client, cleanup):
assert found == set(["cg-doc2"])


@pytest.mark.skipif(
FIRESTORE_EMULATOR, reason="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 +950,9 @@ async def test_partition_query_no_partitions(client, cleanup):
assert found == expected


@pytest.mark.skipif(
FIRESTORE_EMULATOR, reason="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
4 changes: 0 additions & 4 deletions tests/unit/v1/test__helpers.py
Expand Up @@ -15,7 +15,6 @@

import aiounittest
import datetime
import sys
import unittest

import mock
Expand Down Expand Up @@ -485,9 +484,6 @@ def test_float(self):
value = _value_pb(double_value=float_val)
self.assertEqual(self._call_fut(value), float_val)

@unittest.skipIf(
(3,) <= sys.version_info < (3, 4, 4), "known datetime bug (bpo-23517) in Python"
)
def test_datetime(self):
from google.api_core.datetime_helpers import DatetimeWithNanoseconds
from google.protobuf import timestamp_pb2
Expand Down

0 comments on commit 1eb32e2

Please sign in to comment.