mekosotto Claude Sonnet 4.6 commited on
Commit
a3b6bb6
·
1 Parent(s): 9ae5b40

test(mri/model): drop redundant caplog.at_level (direct handler attach is the actual mechanism)

Browse files
Files changed (1) hide show
  1. tests/models/test_mri_model.py +6 -9
tests/models/test_mri_model.py CHANGED
@@ -56,8 +56,6 @@ class TestMRIDLModel:
56
  def test_predict_warns_on_label_count_mismatch(
57
  self, tmp_path: Path, caplog: pytest.LogCaptureFixture
58
  ) -> None:
59
- import logging
60
-
61
  artifact = build_dummy_mri_onnx(tmp_path / "mri_model.onnx")
62
  model = mri_model.load(artifact)
63
 
@@ -65,13 +63,12 @@ class TestMRIDLModel:
65
  # caplog root handler never sees its records. Attach caplog.handler directly.
66
  mri_model.logger.addHandler(caplog.handler)
67
  try:
68
- with caplog.at_level(logging.WARNING, logger="src.models.mri_model"):
69
- result = mri_model.predict_nifti(
70
- model,
71
- _FIXTURE_MRI,
72
- target_shape=(8, 8, 8),
73
- label_names=("control", "abnormal", "extra"),
74
- )
75
  finally:
76
  mri_model.logger.removeHandler(caplog.handler)
77
 
 
56
  def test_predict_warns_on_label_count_mismatch(
57
  self, tmp_path: Path, caplog: pytest.LogCaptureFixture
58
  ) -> None:
 
 
59
  artifact = build_dummy_mri_onnx(tmp_path / "mri_model.onnx")
60
  model = mri_model.load(artifact)
61
 
 
63
  # caplog root handler never sees its records. Attach caplog.handler directly.
64
  mri_model.logger.addHandler(caplog.handler)
65
  try:
66
+ result = mri_model.predict_nifti(
67
+ model,
68
+ _FIXTURE_MRI,
69
+ target_shape=(8, 8, 8),
70
+ label_names=("control", "abnormal", "extra"),
71
+ )
 
72
  finally:
73
  mri_model.logger.removeHandler(caplog.handler)
74