Skip to content

Commit 94374ca

Browse files
Fix flaky test_timeout_set_correctly on PyPy/Windows
Relax assertAlmostEqual tolerance from 2 decimal places (0.005) to 1 (0.05) in timeout tests. The _export_batch refactoring adds a serialization step between deadline calculation and the HTTP POST, consuming a few extra milliseconds that exceed the tight tolerance on slow runtimes like PyPy on Windows.
1 parent 44cc7d8 commit 94374ca

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_log_exporter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ def test_timeout_set_correctly(self, mock_post):
525525

526526
def export_side_effect(*args, **kwargs):
527527
# Timeout should be set to something slightly less than 400 milliseconds depending on how much time has passed.
528-
self.assertAlmostEqual(0.4, kwargs["timeout"], 2)
528+
self.assertAlmostEqual(0.4, kwargs["timeout"], 1)
529529
return resp
530530

531531
mock_post.side_effect = export_side_effect

exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_span_exporter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def test_timeout_set_correctly(self, mock_post):
345345

346346
def export_side_effect(*args, **kwargs):
347347
# Timeout should be set to something slightly less than 400 milliseconds depending on how much time has passed.
348-
self.assertAlmostEqual(0.4, kwargs["timeout"], 2)
348+
self.assertAlmostEqual(0.4, kwargs["timeout"], 1)
349349
return resp
350350

351351
mock_post.side_effect = export_side_effect

0 commit comments

Comments
 (0)