Skip to content

Commit

Permalink
fix: properly clean up after running setup_root_logging in test_log (c…
Browse files Browse the repository at this point in the history
…anonical#1259)

Calling `setup_root_logging` changes `sys.excepthook`. The tests should
undo this in the same way that they clear out the logging handlers that
`setup_root_logging` adds.
  • Loading branch information
tonyandrewmeyer committed Jun 26, 2024
1 parent 585f063 commit 37f2097
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/test_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io
import logging
import re
import sys
import typing
import unittest
from unittest.mock import patch
Expand Down Expand Up @@ -50,6 +51,7 @@ def logger():
logger = logging.getLogger()
yield logger
logging.getLogger().handlers.clear()
sys.excepthook = sys.__excepthook__


class TestLogging:
Expand Down

0 comments on commit 37f2097

Please # to comment.