diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py index f317103c305..80814569d11 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py @@ -25,9 +25,8 @@ from opentelemetry.exporter.otlp.proto.grpc._log_exporter import ( OTLPLogExporter, ) -from opentelemetry.exporter.otlp.proto.grpc.version import __version__ - from opentelemetry.exporter.otlp.proto.grpc.exporter import _translate_value +from opentelemetry.exporter.otlp.proto.grpc.version import __version__ from opentelemetry.proto.collector.logs.v1.logs_service_pb2 import ( ExportLogsServiceRequest, ExportLogsServiceResponse, @@ -253,7 +252,8 @@ def test_otlp_exporter_endpoint(self, mock_secure, mock_insecure): def test_otlp_headers_from_env(self): self.assertEqual( - self.exporter._headers, (("user-agent", "OTel OTLP Exporter Python/" + __version__),) + self.exporter._headers, + (("user-agent", "OTel OTLP Exporter Python/" + __version__),), ) @patch("opentelemetry.exporter.otlp.proto.grpc.exporter._expo") diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_metrics_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_metrics_exporter.py index bca8725c7ea..6436661a985 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_metrics_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_metrics_exporter.py @@ -26,6 +26,7 @@ from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import ( OTLPMetricExporter, ) +from opentelemetry.exporter.otlp.proto.grpc.version import __version__ from opentelemetry.proto.collector.metrics.v1.metrics_service_pb2 import ( ExportMetricsServiceRequest, ExportMetricsServiceResponse, @@ -78,9 +79,6 @@ ) from opentelemetry.test.metrictestutil import _generate_gauge, _generate_sum -from opentelemetry.exporter.otlp.proto.grpc.version import __version__ - - THIS_DIR = dirname(__file__) @@ -416,14 +414,24 @@ def test_otlp_headers_from_env(self, mock_ssl_channel, mock_secure): exporter = OTLPMetricExporter() # pylint: disable=protected-access self.assertEqual( - exporter._headers, (("key1", "value1"), ("key2", "VALUE=2"),("user-agent", "OTel OTLP Exporter Python/" + __version__)) + exporter._headers, + ( + ("key1", "value1"), + ("key2", "VALUE=2"), + ("user-agent", "OTel OTLP Exporter Python/" + __version__), + ), ) exporter = OTLPMetricExporter( headers=(("key3", "value3"), ("key4", "value4")) ) # pylint: disable=protected-access self.assertEqual( - exporter._headers, (("key3", "value3"), ("key4", "value4"),("user-agent", "OTel OTLP Exporter Python/" + __version__)) + exporter._headers, + ( + ("key3", "value3"), + ("key4", "value4"), + ("user-agent", "OTel OTLP Exporter Python/" + __version__), + ), ) @patch.dict( diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_trace_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_trace_exporter.py index 0956e51d8ca..c5bf7e67298 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_trace_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_trace_exporter.py @@ -29,6 +29,7 @@ from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import ( OTLPSpanExporter, ) +from opentelemetry.exporter.otlp.proto.grpc.version import __version__ from opentelemetry.proto.collector.trace.v1.trace_service_pb2 import ( ExportTraceServiceRequest, ExportTraceServiceResponse, @@ -69,8 +70,6 @@ from opentelemetry.test.spantestutil import ( get_span_with_dropped_attributes_events_links, ) -from opentelemetry.exporter.otlp.proto.grpc.version import __version__ - THIS_DIR = os.path.dirname(__file__) @@ -277,21 +276,36 @@ def test_otlp_headers_from_env(self, mock_ssl_channel, mock_secure): exporter = OTLPSpanExporter() # pylint: disable=protected-access self.assertEqual( - exporter._headers, (("key1", "value1"),("key2", "VALUE=2"), ("user-agent", "OTel OTLP Exporter Python/" + __version__)) + exporter._headers, + ( + ("key1", "value1"), + ("key2", "VALUE=2"), + ("user-agent", "OTel OTLP Exporter Python/" + __version__), + ), ) exporter = OTLPSpanExporter( headers=(("key3", "value3"), ("key4", "value4")) ) # pylint: disable=protected-access self.assertEqual( - exporter._headers, (("key3", "value3"), ("key4", "value4"), ("user-agent", "OTel OTLP Exporter Python/" + __version__)) + exporter._headers, + ( + ("key3", "value3"), + ("key4", "value4"), + ("user-agent", "OTel OTLP Exporter Python/" + __version__), + ), ) exporter = OTLPSpanExporter( headers={"key5": "value5", "key6": "value6"} ) # pylint: disable=protected-access self.assertEqual( - exporter._headers, (("key5", "value5"), ("key6", "value6"), ("user-agent", "OTel OTLP Exporter Python/" + __version__)) + exporter._headers, + ( + ("key5", "value5"), + ("key6", "value6"), + ("user-agent", "OTel OTLP Exporter Python/" + __version__), + ), ) @patch.dict( @@ -436,8 +450,11 @@ def test_otlp_exporter_otlp_compression_precendence( def test_otlp_headers(self, mock_ssl_channel, mock_secure): exporter = OTLPSpanExporter() # pylint: disable=protected-access - #This ensures that there is no other header than standard user-agent. - self.assertEqual(exporter._headers, (("user-agent", "OTel OTLP Exporter Python/" + __version__),)) + # This ensures that there is no other header than standard user-agent. + self.assertEqual( + exporter._headers, + (("user-agent", "OTel OTLP Exporter Python/" + __version__),), + ) @patch("opentelemetry.exporter.otlp.proto.grpc.exporter.backoff") @patch("opentelemetry.exporter.otlp.proto.grpc.exporter.sleep") def test_handles_backoff_v2_api(self, mock_sleep, mock_backoff):