Skip to content

Fix caplog not capturing INFO logs in train model cleanup tests - #1143

Merged
ebhills merged 3 commits into
mainfrom
fix/train-test-model-cleanup-caplog-level
Aug 27, 2026
Merged

Fix caplog not capturing INFO logs in train model cleanup tests#1143
ebhills merged 3 commits into
mainfrom
fix/train-test-model-cleanup-caplog-level

Conversation

@mborodii-prog

Copy link
Copy Markdown
Contributor

test_classify_write_logs_new_model_id_integration, test_lookup_write_logs_new_model_id, and test_standardize_write_logs_new_model_id create real models via name: and rely on caplog to find the "New model created" log line to delete them in a finally block. pytest's caplog fixture only captures WARNING+ by default, so the INFO record was never created and the cleanup silently no-op'd, leaking a new model on every run.

test_classify_write_logs_new_model_id_integration, test_lookup_write_logs_new_model_id,
and test_standardize_write_logs_new_model_id create real models via name: and rely on
caplog to find the "New <type> model created" log line to delete them in a finally
block. pytest's caplog fixture only captures WARNING+ by default, so the INFO record
was never created and the cleanup silently no-op'd, leaking a new model on every run.
@mborodii-prog
mborodii-prog requested a review from ebhills August 25, 2026 06:36
@ebhills
ebhills merged commit d5a3eb0 into main Aug 27, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants