Skip to content

Commit 9357e9d

Browse files
authored
test: alter tests, skip tests, to be compatible with emulator (#460)
* test: alter tests, skip tests, to be compatible with emulator
1 parent ea65ec7 commit 9357e9d

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

packages/google-cloud-firestore/tests/system/test_system.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,9 @@ def test_collection_group_queries_filters(client, cleanup):
922922
assert found == set(["cg-doc2"])
923923

924924

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

@@ -953,6 +956,9 @@ def test_partition_query_no_partitions(client, cleanup):
953956
assert found == expected
954957

955958

959+
@pytest.mark.skipif(
960+
FIRESTORE_EMULATOR, reason="PartitionQuery not implemented in emulator"
961+
)
956962
def test_partition_query(client, cleanup):
957963
collection_group = "b" + UNIQUE_RESOURCE_ID
958964
n_docs = 128 * 2 + 127 # Minimum partition size is 128
@@ -1514,11 +1520,14 @@ def test_watch_query_order(client, cleanup):
15141520
# Setup listener
15151521
def on_snapshot(docs, changes, read_time):
15161522
try:
1523+
docs = [i for i in docs if i.id.endswith(UNIQUE_RESOURCE_ID)]
15171524
if len(docs) != 5:
15181525
return
15191526
# A snapshot should return the same thing as if a query ran now.
15201527
query_ran = query_ref.stream()
1521-
query_ran_results = [i for i in query_ran]
1528+
query_ran_results = [
1529+
i for i in query_ran if i.id.endswith(UNIQUE_RESOURCE_ID)
1530+
]
15221531
assert len(docs) == len(query_ran_results)
15231532

15241533
# compare the order things are returned

packages/google-cloud-firestore/tests/system/test_system_async.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,9 @@ async def test_collection_group_queries_filters(client, cleanup):
917917
assert found == set(["cg-doc2"])
918918

919919

920+
@pytest.mark.skipif(
921+
FIRESTORE_EMULATOR, reason="PartitionQuery not implemented in emulator"
922+
)
920923
async def test_partition_query_no_partitions(client, cleanup):
921924
collection_group = "b" + UNIQUE_RESOURCE_ID
922925

@@ -947,6 +950,9 @@ async def test_partition_query_no_partitions(client, cleanup):
947950
assert found == expected
948951

949952

953+
@pytest.mark.skipif(
954+
FIRESTORE_EMULATOR, reason="PartitionQuery not implemented in emulator"
955+
)
950956
async def test_partition_query(client, cleanup):
951957
collection_group = "b" + UNIQUE_RESOURCE_ID
952958
n_docs = 128 * 2 + 127 # Minimum partition size is 128

packages/google-cloud-firestore/tests/unit/v1/test__helpers.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import aiounittest
1717
import datetime
18-
import sys
1918
import unittest
2019

2120
import mock
@@ -485,9 +484,6 @@ def test_float(self):
485484
value = _value_pb(double_value=float_val)
486485
self.assertEqual(self._call_fut(value), float_val)
487486

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

0 commit comments

Comments
 (0)