Skip to content

Commit 52a5e93

Browse files
catch_warnings instead of assertLogs in test
1 parent dca0d41 commit 52a5e93

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

opentelemetry-sdk/tests/logs/test_export.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import os
1818
import time
1919
import unittest
20+
import warnings
2021
from concurrent.futures import ThreadPoolExecutor
2122
from sys import version_info
2223
from unittest.mock import Mock, patch
@@ -193,7 +194,7 @@ def test_simple_log_record_processor_shutdown(self):
193194
)
194195
exporter.clear()
195196
logger_provider.shutdown()
196-
with self.assertLogs(level=logging.WARNING):
197+
with warnings.catch_warnings(record=True):
197198
logger.warning("Log after shutdown")
198199
finished_logs = exporter.get_finished_logs()
199200
self.assertEqual(len(finished_logs), 0)

0 commit comments

Comments
 (0)