fix: TypeError - requests.Session.request() got an unexpected keyword argument 'user_agent_overwrite' #45653
Azure Pipelines / python - cosmos - ci
failed
Mar 13, 2026 in 36m 21s
Build #20260312.5 had test failures
Details
- Failed: 2 (0.02%)
- Passed: 9,028 (99.21%)
- Other: 70 (0.77%)
- Total: 9,100
Annotations
Check failure on line 4504 in Build log
azure-pipelines / python - cosmos - ci
Build log #L4504
PowerShell exited with code '1'.
Check failure on line 27 in Build log
azure-pipelines / python - cosmos - ci
Build log #L27
There are one or more test failures detected in result files. Detailed summary of published test results can be viewed in the Tests tab.
Check failure on line 1 in test_service_request_retry_policy
azure-pipelines / python - cosmos - ci
test_service_request_retry_policy
assert 1 == 3
+ where 1 = <test_service_retry_policies.TestServiceRetryPolicies.MockExecuteServiceRequestExceptionIgnoreQuery object at 0x0000014E7D5BC050>.counter
Raw output
self = <test_service_retry_policies.TestServiceRetryPolicies testMethod=test_service_request_retry_policy>
def test_service_request_retry_policy(self):
mock_client = CosmosClient(self.host, self.masterKey)
db = mock_client.get_database_client(self.TEST_DATABASE_ID)
container = db.get_container_client(self.TEST_CONTAINER_ID)
created_item = container.create_item({"id": str(uuid.uuid4()), "pk": str(uuid.uuid4())})
# Save the original function
self.original_execute_function = _retry_utility.ExecuteFunction
# Change the location cache to have 3 preferred read regions and 3 available read endpoints by location
original_location_cache = mock_client.client_connection._global_endpoint_manager.location_cache
original_location_cache.account_read_locations = [self.REGION1, self.REGION2, self.REGION3]
original_location_cache.available_read_regional_endpoints_by_locations = {self.REGION1: self.REGIONAL_ENDPOINT,
self.REGION2: self.REGIONAL_ENDPOINT,
self.REGION3: self.REGIONAL_ENDPOINT}
original_location_cache.read_regional_routing_contexts = [self.REGIONAL_ENDPOINT, self.REGIONAL_ENDPOINT,
self.REGIONAL_ENDPOINT]
expected_counter = len(original_location_cache.read_regional_routing_contexts)
try:
# Mock the function to return the ServiceRequestException we retry
mf = self.MockExecuteServiceRequestExceptionIgnoreQuery(self.original_execute_function)
_retry_utility.ExecuteFunction = mf
> container.read_item(created_item['id'], created_item['pk'])
tests\test_service_retry_policies.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\core\tracing\decorator.py:119: in wrapper_use_tracer
return func(*args, **kwargs)
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\container.py:301: in read_item
return self.client_connection.ReadItem(document_link=doc_link, options=request_options, **kwargs)
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:1505: in ReadItem
return self.Read(path, http_constants.ResourceType.Document, document_id, None, options, **kwargs)
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:2949: in Read
result, last_response_headers = self.__Get(path, request_params, headers, **kwargs)
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:3021: in __Get
return synchronized_request.SynchronizedRequest(
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\_synchronized_request.py:288: in SynchronizedRequest
return _retry_utility.Execute(
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\_retry_utility.py:278: in Execute
_handle_service_request_retries(client, service_request_retry_policy, e, *args)
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\_retry_utility.py:342: in _handle_service_request_retries
raise exception
..\..\..\.venv\azure-cosmos\.venv_sdist\Lib\site-packages\azure\cosmos\_retry_utility.py:138: in Execute
result = ExecuteFunction(function, global_endpoint_manager, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_service_retry_policies.TestServiceRetryPolicies.MockExecuteServiceRequestExceptionIgnoreQuery object at 0x0000014E7D5BC050>
func = <function _Request at 0x0000014E3BA3D800>
args = (<azure.cosmos._global_partition_endpoint_manager_per_partition_automatic_failover._GlobalPartitionEndpointManagerForP..
Check failure on line 1 in test_service_request_retry_policy
azure-pipelines / python - cosmos - ci
test_service_request_retry_policy
assert 1 == 3
+ where 1 = <test_service_retry_policies.TestServiceRetryPolicies.MockExecuteServiceRequestExceptionIgnoreQuery object at 0x0000023B116574D0>.counter
Raw output
self = <test_service_retry_policies.TestServiceRetryPolicies testMethod=test_service_request_retry_policy>
def test_service_request_retry_policy(self):
mock_client = CosmosClient(self.host, self.masterKey)
db = mock_client.get_database_client(self.TEST_DATABASE_ID)
container = db.get_container_client(self.TEST_CONTAINER_ID)
created_item = container.create_item({"id": str(uuid.uuid4()), "pk": str(uuid.uuid4())})
# Save the original function
self.original_execute_function = _retry_utility.ExecuteFunction
# Change the location cache to have 3 preferred read regions and 3 available read endpoints by location
original_location_cache = mock_client.client_connection._global_endpoint_manager.location_cache
original_location_cache.account_read_locations = [self.REGION1, self.REGION2, self.REGION3]
original_location_cache.available_read_regional_endpoints_by_locations = {self.REGION1: self.REGIONAL_ENDPOINT,
self.REGION2: self.REGIONAL_ENDPOINT,
self.REGION3: self.REGIONAL_ENDPOINT}
original_location_cache.read_regional_routing_contexts = [self.REGIONAL_ENDPOINT, self.REGIONAL_ENDPOINT,
self.REGIONAL_ENDPOINT]
expected_counter = len(original_location_cache.read_regional_routing_contexts)
try:
# Mock the function to return the ServiceRequestException we retry
mf = self.MockExecuteServiceRequestExceptionIgnoreQuery(self.original_execute_function)
_retry_utility.ExecuteFunction = mf
> container.read_item(created_item['id'], created_item['pk'])
tests\test_service_retry_policies.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\..\..\.venv\azure-cosmos\.venv_whl\Lib\site-packages\azure\core\tracing\decorator.py:119: in wrapper_use_tracer
return func(*args, **kwargs)
..\..\..\.venv\azure-cosmos\.venv_whl\Lib\site-packages\azure\cosmos\container.py:301: in read_item
return self.client_connection.ReadItem(document_link=doc_link, options=request_options, **kwargs)
..\..\..\.venv\azure-cosmos\.venv_whl\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:1505: in ReadItem
return self.Read(path, http_constants.ResourceType.Document, document_id, None, options, **kwargs)
..\..\..\.venv\azure-cosmos\.venv_whl\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:2949: in Read
result, last_response_headers = self.__Get(path, request_params, headers, **kwargs)
..\..\..\.venv\azure-cosmos\.venv_whl\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:3021: in __Get
return synchronized_request.SynchronizedRequest(
..\..\..\.venv\azure-cosmos\.venv_whl\Lib\site-packages\azure\cosmos\_synchronized_request.py:288: in SynchronizedRequest
return _retry_utility.Execute(
..\..\..\.venv\azure-cosmos\.venv_whl\Lib\site-packages\azure\cosmos\_retry_utility.py:278: in Execute
_handle_service_request_retries(client, service_request_retry_policy, e, *args)
..\..\..\.venv\azure-cosmos\.venv_whl\Lib\site-packages\azure\cosmos\_retry_utility.py:342: in _handle_service_request_retries
raise exception
..\..\..\.venv\azure-cosmos\.venv_whl\Lib\site-packages\azure\cosmos\_retry_utility.py:138: in Execute
result = ExecuteFunction(function, global_endpoint_manager, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_service_retry_policies.TestServiceRetryPolicies.MockExecuteServiceRequestExceptionIgnoreQuery object at 0x0000023B116574D0>
func = <function _Request at 0x0000023B6EAC19E0>
args = (<azure.cosmos._global_partition_endpoint_manager_per_partition_automatic_failover._GlobalPartitionEndpointManagerForP...2/colls/SinglePar
Loading