Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 94924ae

Browse files
committed
skip AsyncMock test in 3.7
1 parent 4a58868 commit 94924ae

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

tests/system/test_retry_streaming.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def test_streaming_transient_retryable_partial_data(sequence):
135135
"""
136136
from google.protobuf.duration_pb2 import Duration
137137

138-
if type(sequence.transport) == type(sequence).get_transport_class("rest"):
138+
if isinstance(sequence.transport, type(sequence).get_transport_class("rest")):
139139
pytest.skip("Skipping due to known streaming issue in rest client")
140140

141141
retry = retries.StreamingRetry(

tests/system/test_retry_streaming_async.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import pytest
16+
import sys
1617
from unittest import mock
1718
from google.rpc.status_pb2 import Status
1819
from datetime import timedelta
@@ -263,6 +264,7 @@ def on_error(exc):
263264
],
264265
)
265266
@pytest.mark.asyncio
267+
@pytest.mark.skipif(sys.version_info < (3, 8), reason="AsyncMock requires 3.8")
266268
async def test_async_streaming_retry_sleep_generator(
267269
async_sequence, initial, multiplier, maximum, expected
268270
):
@@ -294,7 +296,7 @@ async def test_async_streaming_retry_sleep_generator(
294296
with mock.patch("random.uniform") as mock_uniform:
295297
# make sleep generator deterministic
296298
mock_uniform.side_effect = lambda a, b: b
297-
with mock.patch("asyncio.sleep") as mock_sleep:
299+
with mock.patch("asyncio.sleep", mock.AsyncMock) as mock_sleep:
298300
it = await async_sequence.attempt_streaming_sequence(
299301
name=seq.name, retry=retry
300302
)

0 commit comments

Comments
 (0)