diff --git a/tests/instrumentation/grpc_tests.py b/tests/instrumentation/grpc_tests.py index 70fbd6222..81827a391 100644 --- a/tests/instrumentation/grpc_tests.py +++ b/tests/instrumentation/grpc_tests.py @@ -32,7 +32,7 @@ grpc = pytest.importorskip("grpc") -from unittest.mock import MagicMock, call, patch +from unittest.mock import MagicMock, patch pytestmark = pytest.mark.grpc @@ -209,7 +209,7 @@ def test_no_interceptors_adds_server_interceptor_via_kwargs(self): kwargs={}, ) - interceptors_passed = wrapped.call_args.kwargs["interceptors"] + interceptors_passed = wrapped.call_args[1]["interceptors"] assert interceptors_passed[0] is MockInterceptor.return_value assert result is fake_server @@ -229,7 +229,7 @@ def test_existing_interceptors_via_kwargs_prepends_server_interceptor(self): kwargs={"interceptors": [existing]}, ) - interceptors_passed = wrapped.call_args.kwargs["interceptors"] + interceptors_passed = wrapped.call_args[1]["interceptors"] assert interceptors_passed[0] is MockInterceptor.return_value assert interceptors_passed[1] is existing @@ -251,7 +251,7 @@ def test_existing_interceptors_via_positional_args(self): kwargs={}, ) - call_args = wrapped.call_args.args + call_args = wrapped.call_args[0] interceptors_passed = call_args[2] assert interceptors_passed[0] is MockInterceptor.return_value assert interceptors_passed[1] is existing @@ -272,7 +272,7 @@ def test_no_interceptors_in_positional_args_uses_kwargs(self): kwargs={}, ) - interceptors_passed = wrapped.call_args.kwargs["interceptors"] + interceptors_passed = wrapped.call_args[1]["interceptors"] assert interceptors_passed[0] is MockInterceptor.return_value @@ -298,7 +298,7 @@ def test_no_interceptors_adds_async_interceptor_via_kwargs(self): kwargs={}, ) - interceptors_passed = wrapped.call_args.kwargs["interceptors"] + interceptors_passed = wrapped.call_args[1]["interceptors"] assert interceptors_passed[0] is MockInterceptor.return_value assert result is fake_server @@ -318,7 +318,7 @@ def test_existing_interceptors_via_kwargs_prepends_async_interceptor(self): kwargs={"interceptors": [existing]}, ) - interceptors_passed = wrapped.call_args.kwargs["interceptors"] + interceptors_passed = wrapped.call_args[1]["interceptors"] assert interceptors_passed[0] is MockInterceptor.return_value assert interceptors_passed[1] is existing @@ -339,7 +339,7 @@ def test_existing_interceptors_via_positional_args(self): kwargs={}, ) - call_args = wrapped.call_args.args + call_args = wrapped.call_args[0] interceptors_passed = call_args[2] assert interceptors_passed[0] is MockInterceptor.return_value assert interceptors_passed[1] is existing @@ -360,5 +360,5 @@ def test_no_interceptors_in_short_positional_args_uses_kwargs(self): kwargs={}, ) - interceptors_passed = wrapped.call_args.kwargs["interceptors"] + interceptors_passed = wrapped.call_args[1]["interceptors"] assert interceptors_passed[0] is MockInterceptor.return_value