Skip to content

Commit 93a8e5a

Browse files
committed
Additional test tweaks to prevent non-significant failures
Surprisingly, these tweaks are not needed without the other changes in this PR.
1 parent 7229c28 commit 93a8e5a

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

tests/unit/test_bidi.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,10 @@ def test_rpc_callback_fires_when_consumer_start_fails(self):
828828
bidi_rpc._start_rpc.side_effect = expected_exception
829829

830830
consumer = bidi.BackgroundConsumer(bidi_rpc, on_response=None)
831+
# Wait for the consumer's thread to exit.
832+
while consumer.is_active:
833+
pass
834+
831835
consumer.start()
832836
assert callback.call_args.args[0] == grpc.StatusCode.INVALID_ARGUMENT
833837

tests/unit/test_timeout.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import datetime
1616
import itertools
17+
import pytest
1718
from unittest import mock
1819

1920
from google.api_core import timeout as timeouts
@@ -121,7 +122,15 @@ def test_apply_passthrough(self):
121122

122123
wrapped(1, 2, meep="moop")
123124

124-
target.assert_called_once_with(1, 2, meep="moop", timeout=42.0)
125+
actual_arg_0 = target.call_args[0][0]
126+
actual_arg_1 = target.call_args[0][1]
127+
actual_arg_meep = target.call_args[1]["meep"]
128+
actual_arg_timeuut = target.call_args[1]["timeout"]
129+
130+
assert actual_arg_0 == 1
131+
assert actual_arg_1 == 2
132+
assert actual_arg_meep == "moop"
133+
assert actual_arg_timeuut == pytest.approx(42.0, abs=0.01)
125134

126135

127136
class TestConstantTimeout(object):

0 commit comments

Comments
 (0)