Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydvoss committed Aug 30, 2024
1 parent 8367a25 commit 91affe4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
25 changes: 18 additions & 7 deletions opentelemetry-sdk/tests/logs/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ def test_simple_log_record_processor_different_msg_types(self):
]
self.assertEqual(expected, emitted)

def test_simple_log_record_processor_different_msg_types_with_formatter(self):
def test_simple_log_record_processor_different_msg_types_with_formatter(
self,
):
self.maxDiff = None
exporter = InMemoryLogExporter()
log_record_processor = BatchLogRecordProcessor(exporter)
Expand All @@ -217,9 +219,9 @@ def test_simple_log_record_processor_different_msg_types_with_formatter(self):

logger = logging.getLogger("different_msg_types")
handler = LoggingHandler(logger_provider=provider)
handler.setFormatter(logging.Formatter(
"%(name)s - %(levelname)s - %(message)s"
))
handler.setFormatter(
logging.Formatter("%(name)s - %(levelname)s - %(message)s")
)
logger.addHandler(handler)

logger.warning("warning message: %s", "possible upcoming heatwave")
Expand All @@ -231,13 +233,22 @@ def test_simple_log_record_processor_different_msg_types_with_formatter(self):

finished_logs = exporter.get_finished_logs()
expected = [
("different_msg_types - WARNING - warning message: possible upcoming heatwave", "WARN"),
("different_msg_types - ERROR - Very high rise in temperatures across the globe", "ERROR"),
(
"different_msg_types - WARNING - warning message: possible upcoming heatwave",
"WARN",
),
(
"different_msg_types - ERROR - Very high rise in temperatures across the globe",
"ERROR",
),
(
"different_msg_types - CRITICAL - Temperature hits high 420 C in Hyderabad",
"CRITICAL",
),
("different_msg_types - WARNING - ['list', 'of', 'strings']", "WARN"),
(
"different_msg_types - WARNING - ['list', 'of', 'strings']",
"WARN",
),
("different_msg_types - ERROR - {'key': 'value'}", "ERROR"),
]
emitted = [
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/tests/logs/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
import logging
import unittest
from unittest.mock import Mock, MagicMock
from unittest.mock import Mock

from opentelemetry._logs import NoOpLoggerProvider, SeverityNumber
from opentelemetry._logs import get_logger as APIGetLogger
Expand Down

0 comments on commit 91affe4

Please sign in to comment.