Open
Description
On Python 3.12, the testsuite fails with the following tests:
[ 31s] =========================== short test summary info ============================
[ 31s] FAILED tests/unit/common/monitored_resource_util/test_monitored_resource.py::TestMonitoredResource::test_aws_monitored_resource
[ 31s] FAILED tests/unit/common/monitored_resource_util/test_monitored_resource.py::TestMonitoredResource::test_gcp_gce_monitored_resource
[ 31s] FAILED tests/unit/common/monitored_resource_util/test_monitored_resource.py::TestMonitoredResource::test_gcp_k8s_monitored_resource
[ 31s] FAILED tests/unit/stats/test_aggregation_data.py::TestDistributionAggregationData::test_exemplar_int_attachment_key
[ 31s] FAILED tests/unit/stats/test_aggregation_data.py::TestDistributionAggregationData::test_exemplar_int_attachment_value
[ 31s] FAILED tests/unit/stats/test_aggregation_data.py::TestDistributionAggregationData::test_exemplar_null_attachment_key
[ 31s] FAILED tests/unit/stats/test_aggregation_data.py::TestDistributionAggregationData::test_exemplar_null_attachment_value
[ 31s] FAILED tests/unit/stats/test_aggregation_data.py::TestDistributionAggregationData::test_exemplar_null_attachments
[ 31s] FAILED tests/unit/stats/test_measurement_map.py::TestMeasurementMap::test_put_attachment_int_key
[ 31s] FAILED tests/unit/stats/test_measurement_map.py::TestMeasurementMap::test_put_attachment_int_value
[ 31s] FAILED tests/unit/stats/test_measurement_map.py::TestMeasurementMap::test_put_attachment_none_key
[ 31s] FAILED tests/unit/stats/test_measurement_map.py::TestMeasurementMap::test_put_attachment_none_value
[ 31s] ========== 12 failed, 535 passed, 2 deselected, 94 warnings in 4.26s ===========
One of the test failures looks like this:
[ 24s] ______________ TestMonitoredResource.test_aws_monitored_resource _______________
[ 24s]
[ 24s] self = <test_monitored_resource.TestMonitoredResource testMethod=test_aws_monitored_resource>
[ 24s] aws_md_mock = <MagicMock name='AwsIdentityDocumentUtils' id='140226359062464'>
[ 24s]
[ 24s] @mock.patch('opencensus.common.monitored_resource.monitored_resource'
[ 24s] '.aws_identity_doc_utils.AwsIdentityDocumentUtils')
[ 24s] def test_aws_monitored_resource(self, aws_md_mock):
[ 24s]
[ 24s] mocked_labels = {
[ 24s] 'instance_id': 'i-1234567890abcdef0',
[ 24s] 'aws_account': '123456789012',
[ 24s] 'region': 'us-west-2'
[ 24s] }
[ 24s]
[ 24s] aws_md_mock.return_value = mock.Mock()
[ 24s] aws_md_mock.return_value.get_aws_metadata.return_value = mocked_labels
[ 24s]
[ 24s] with mock_aws_env():
[ 24s] resource = monitored_resource.get_instance()
[ 24s] self.assertEqual(resource.get_type(), 'aws_ec2_instance')
[ 24s] self.assertEqual(resource.get_labels(), mocked_labels)
[ 24s]
[ 24s] with mock_oc_env():
[ 24s] with mock_aws_env():
[ 24s] resource = monitored_resource.get_instance()
[ 24s] self.assertEqual(resource.get_type(), 'mock_resource_type')
[ 24s] > self.assertDictContainsSubset(
[ 24s] {'mock_label_key': 'mock_label_value'}, resource.get_labels())
[ 24s] E AttributeError: 'TestMonitoredResource' object has no attribute 'assertDictContainsSubset'
[ 24s]
[ 24s] tests/unit/common/monitored_resource_util/test_monitored_resource.py:169: AttributeError