Skip to content

Commit e909591

Browse files
committed
add regression test
1 parent f68f012 commit e909591

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/panels/test_logging.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
from unittest.mock import patch
23

34
from debug_toolbar.panels.logging import (
45
MESSAGE_IF_STRING_REPRESENTATION_INVALID,
@@ -86,3 +87,10 @@ def view(request):
8687
self.assertEqual(
8788
MESSAGE_IF_STRING_REPRESENTATION_INVALID, records[0]["message"]
8889
)
90+
91+
@patch("sys.stderr")
92+
def test_fallback_logging(self, mock_stderr):
93+
# make sure the log reaches stderr even though logging set up
94+
# its own handler during its import
95+
self.logger.warning("hello")
96+
mock_stderr.write.assert_called_once_with("hello\n")

0 commit comments

Comments
 (0)