Skip to content

Commit 9a155df

Browse files
authored
Fix 1455: Protect from raw next() calls (#1456)
1 parent 6347ce0 commit 9a155df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

instrumentation/opentelemetry-instrumentation-tornado/tests/test_metrics_instrumentation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def sorted_metrics(metrics):
5757
def assert_metric_expected(
5858
self, metric, expected_value, expected_attributes
5959
):
60-
data_point = next(metric.data.data_points)
60+
data_point = next(iter(metric.data.data_points))
6161

6262
if isinstance(data_point, HistogramDataPoint):
6363
self.assertEqual(
@@ -78,7 +78,7 @@ def assert_metric_expected(
7878
def assert_duration_metric_expected(
7979
self, metric, duration_estimated, expected_attributes
8080
):
81-
data_point = next(metric.data.data_points)
81+
data_point = next(iter(metric.data.data_points))
8282

8383
self.assertAlmostEqual(
8484
data_point.sum,

0 commit comments

Comments
 (0)