Skip to content

Commit 1152818

Browse files
Refactor logging handler deduplication test to remove unnecessary app variable assignments and enhance error logging during cleanup
1 parent 2b48edb commit 1152818

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/tests/backend/app_test.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ def test_logging_handler_deduplication():
5656
initial_handler_count = sum(1 for h in root_logger.handlers if isinstance(h, LoggingHandler))
5757

5858
# Create first app
59-
app1 = create_app()
59+
create_app()
6060
handler_count_after_first = sum(1 for h in root_logger.handlers if isinstance(h, LoggingHandler))
6161

6262
# Create second app
63-
app2 = create_app()
63+
create_app()
6464
handler_count_after_second = sum(1 for h in root_logger.handlers if isinstance(h, LoggingHandler))
6565

6666
# Assert only one LoggingHandler exists after multiple create_app() calls
@@ -76,7 +76,10 @@ def test_logging_handler_deduplication():
7676
try:
7777
handler.close()
7878
except Exception:
79-
pass
79+
logging.getLogger(__name__).debug(
80+
"Failed to close LoggingHandler during test cleanup",
81+
exc_info=True,
82+
)
8083
finally:
8184
# Restore original environment
8285
if original_env is not None:

0 commit comments

Comments
 (0)