[Core] Update for next-pylint #44566
Merged
Azure Pipelines / python - cosmos - ci
succeeded
Jan 9, 2026 in 35m 47s
Build #20260106.10 had test failures
Details
- Failed: 2 (0.03%)
- Passed: 6,098 (99.15%)
- Other: 50 (0.81%)
- Total: 6,150
Annotations
Check failure on line 1 in test_cross_region_retry[502]
azure-pipelines / python - cosmos - ci
test_cross_region_retry[502]
AssertionError: assert 'https://127.0.0.1:8081/' == 'other-region'
- other-region
+ https://127.0.0.1:8081/
Raw output
self = <test_timeout_and_failover_retry_policy.TestTimeoutRetryPolicy object at 0x0000028EAD645850>
setup = {'created_collection': <ContainerProxy [dbs/PythonSDKTestDatabase-b4cda0c0-6499-4dc5-a9a5-2fb317ec49ab/colls/test-timeout-retry-policy-container-3792b759-ad75-413c-8379-3ed44c373a52]>}
error_code = 502
@pytest.mark.parametrize("error_code", error_codes())
def test_cross_region_retry(self, setup, error_code):
mock_client = cosmos_client.CosmosClient(self.host, self.masterKey)
db = mock_client.get_database_client(self.TEST_DATABASE_ID)
container = db.get_container_client(self.TEST_CONTAINER_SINGLE_PARTITION_ID)
document_definition = {'id': 'failoverDoc' + str(uuid.uuid4()),
'pk': 'pk',
'name': 'sample document',
'key': 'value'}
created_document = container.create_item(body=document_definition)
self.original_execute_function = _retry_utility.ExecuteFunction
original_location_cache = mock_client.client_connection._global_endpoint_manager.location_cache
fake_endpoint = "other-region"
region_1 = "East US"
region_2 = "West US"
regional_routing_context = RegionalRoutingContext(self.host)
regional_routing_context_2 = RegionalRoutingContext(fake_endpoint)
original_location_cache.account_read_locations = [region_1, region_2]
original_location_cache.account_read_regional_routing_contexts_by_location = {region_1: regional_routing_context,
region_2: regional_routing_context_2
}
original_location_cache.read_regional_routing_contexts = [regional_routing_context, regional_routing_context_2]
try:
# should retry once and then succeed
mf = self.MockExecuteFunctionCrossRegion(self.original_execute_function, error_code, fake_endpoint)
_retry_utility.ExecuteFunction = mf
> container.read_item(item=created_document['id'],
partition_key=created_document['pk'])
tests\test_timeout_and_failover_retry_policy.py:144:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox\mindependency\Lib\site-packages\azure\core\tracing\decorator.py:78: in wrapper_use_tracer
return func(*args, **kwargs)
.tox\mindependency\Lib\site-packages\azure\cosmos\container.py:300: in read_item
return self.client_connection.ReadItem(document_link=doc_link, options=request_options, **kwargs)
.tox\mindependency\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:1498: in ReadItem
return self.Read(path, http_constants.ResourceType.Document, document_id, None, options, **kwargs)
.tox\mindependency\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:2942: in Read
result, last_response_headers = self.__Get(path, request_params, headers, **kwargs)
.tox\mindependency\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:3014: in __Get
return synchronized_request.SynchronizedRequest(
.tox\mindependency\Lib\site-packages\azure\cosmos\_synchronized_request.py:286: in SynchronizedRequest
return _retry_utility.Execute(
.tox\mindependency\Lib\site-packages\azure\cosmos\_retry_utility.py:138: in Execute
result = ExecuteFunction(function, global_endpoint_manager, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_timeout_and_failover_retry_policy.TestTimeoutRetryPolicy.MockExecuteFunctionCrossRegion object at 0x0000028EAACA8B90>
func = <function _Request at 0x0000028EA7479E40>
args = (<azure.cosmos._global_partition_endpoint_manager_per_partition_automatic_failover._GlobalPartitionEndpointManagerForP...ut-retry-policy-container-3792b759-ad75-413c-8379-3ed44c373a52/docs/fai
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 0x00000285BAFCFAA0>.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:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox\whl\Lib\site-packages\azure\core\tracing\decorator.py:119: in wrapper_use_tracer
return func(*args, **kwargs)
.tox\whl\Lib\site-packages\azure\cosmos\container.py:300: in read_item
return self.client_connection.ReadItem(document_link=doc_link, options=request_options, **kwargs)
.tox\whl\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:1498: in ReadItem
return self.Read(path, http_constants.ResourceType.Document, document_id, None, options, **kwargs)
.tox\whl\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:2942: in Read
result, last_response_headers = self.__Get(path, request_params, headers, **kwargs)
.tox\whl\Lib\site-packages\azure\cosmos\_cosmos_client_connection.py:3014: in __Get
return synchronized_request.SynchronizedRequest(
.tox\whl\Lib\site-packages\azure\cosmos\_synchronized_request.py:286: in SynchronizedRequest
return _retry_utility.Execute(
.tox\whl\Lib\site-packages\azure\cosmos\_retry_utility.py:278: in Execute
_handle_service_request_retries(client, service_request_retry_policy, e, *args)
.tox\whl\Lib\site-packages\azure\cosmos\_retry_utility.py:342: in _handle_service_request_retries
raise exception
.tox\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 0x00000285BAFCFAA0>
func = <function _Request at 0x00000285F8F916C0>
args = (<azure.cosmos._global_partition_endpoint_manager_per_partition_automatic_failover._GlobalPartitionEndpointManagerForP...e/colls/SinglePartitionTestContainer-f78f81d5-a051-4500-99c3-5749ab589625/docs/f2ad4585-90dd-4043-9a3d-6291e45b9d13/'>)
kwargs = {}
request_obj = <azure.cosmos._request_object.RequestObject object at 0x0000028583FF9FA0>
exception = ServiceRequestError('mock exception')
def
Loading