Skip to content

Commit 4dd85b3

Browse files
committed
fix: fix async tests
1 parent 6966a1a commit 4dd85b3

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

tests/asyncio/gapic/test_method_async.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,11 @@ async def test_wrap_method_with_overriding_timeout_as_a_number():
256256
result = await wrapped_method(timeout=22)
257257

258258
assert result == 42
259-
method.assert_called_once_with(timeout=22, metadata=mock.ANY)
259+
260+
actual_timeout = method.call_args[1]["timeout"]
261+
metadata = method.call_args[1]["metadata"]
262+
assert metadata == mock.ANY
263+
assert actual_timeout == pytest.approx(22, abs=0.01)
260264

261265

262266
@pytest.mark.asyncio

tests/unit/gapic/test_method.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,11 @@ def test_wrap_method_with_overriding_timeout_as_a_number():
201201
result = wrapped_method(timeout=22)
202202

203203
assert result == 42
204-
method.assert_called_once_with(timeout=22, metadata=mock.ANY)
204+
205+
actual_timeout = method.call_args[1]["timeout"]
206+
metadata = method.call_args[1]["metadata"]
207+
assert metadata == mock.ANY
208+
assert actual_timeout == pytest.approx(22, abs=0.01)
205209

206210

207211
def test_wrap_method_with_call():

0 commit comments

Comments
 (0)