Skip to content

Commit 6ec6451

Browse files
committed
use summary.display() for nicer test logs
1 parent 19e2092 commit 6ec6451

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

tests/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from __future__ import annotations
22

33
import subprocess
4-
import warnings
54
from itertools import chain
65
from typing import Dict, List
76

7+
from loguru import logger
88
from pytest import FixtureRequest, fixture
99

1010
from bioimageio.spec import __version__ as bioimageio_spec_version
@@ -13,7 +13,7 @@
1313
import torch
1414

1515
torch_version = tuple(map(int, torch.__version__.split(".")[:2]))
16-
warnings.warn(f"detected torch version {torch.__version__}")
16+
logger.warning("detected torch version {}", torch.__version__)
1717
except ImportError:
1818
torch = None
1919
torch_version = None
@@ -40,7 +40,7 @@
4040

4141
skip_tensorflow = tensorflow is None
4242

43-
warnings.warn(f"testing with bioimageio.spec {bioimageio_spec_version}")
43+
logger.warning("testing with bioimageio.spec {}", bioimageio_spec_version)
4444

4545
# TODO: use models from new collection on S3
4646
MODEL_SOURCES: Dict[str, str] = {

tests/test_any_model_fixture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
def test_model(any_model: str):
55
summary = load_description_and_validate_format_only(any_model)
6-
assert summary.status == "passed", summary.format()
6+
assert summary.status == "passed", summary.display()

tests/test_resource_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_test_model(any_model: str):
4141
with ValidationContext(raise_errors=True):
4242
summary = test_model(any_model)
4343

44-
assert summary.status == "passed", summary.format()
44+
assert summary.status == "passed", summary.display()
4545

4646

4747
def test_loading_description_multiple_times(unet2d_nuclei_broad_model: str):

tests/test_weight_converters.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_pytorch_to_torchscript(any_torch_model, tmp_path):
2121
assert ret_val.source == out_path
2222
model_descr.weights.torchscript = ret_val
2323
summary = test_model(model_descr, weight_format="torchscript")
24-
assert summary.status == "passed", summary.format()
24+
assert summary.status == "passed", summary.display()
2525

2626

2727
def test_pytorch_to_onnx(convert_to_onnx, tmp_path):
@@ -42,7 +42,7 @@ def test_pytorch_to_onnx(convert_to_onnx, tmp_path):
4242

4343
model_descr.weights.onnx = ret_val
4444
summary = test_model(model_descr, weight_format="onnx")
45-
assert summary.status == "passed", summary.format()
45+
assert summary.status == "passed", summary.display()
4646

4747

4848
def test_keras_to_tensorflow(any_keras_model: Path, tmp_path: Path):
@@ -57,7 +57,7 @@ def test_keras_to_tensorflow(any_keras_model: Path, tmp_path: Path):
5757

5858
model_descr.weights.keras = ret_val
5959
summary = test_model(model_descr, weight_format="keras_hdf5")
60-
assert summary.status == "passed", summary.format()
60+
assert summary.status == "passed", summary.display()
6161

6262

6363
@pytest.mark.skip()
@@ -78,7 +78,7 @@ def test_keras_to_tensorflow_zipped(any_keras_model: Path, tmp_path: Path):
7878

7979
model_descr.weights.keras = ret_val
8080
summary = test_model(model_descr, weight_format="keras_hdf5")
81-
assert summary.status == "passed", summary.format()
81+
assert summary.status == "passed", summary.display()
8282

8383

8484
# TODO: add tensorflow_to_keras converter
@@ -94,7 +94,7 @@ def test_keras_to_tensorflow_zipped(any_keras_model: Path, tmp_path: Path):
9494

9595
# model_descr.weights.keras = ret_val
9696
# summary = test_model(model_descr, weight_format="keras_hdf5")
97-
# assert summary.status == "passed", summary.format()
97+
# assert summary.status == "passed", summary.display()
9898

9999

100100
# @pytest.mark.skip()
@@ -115,4 +115,4 @@ def test_keras_to_tensorflow_zipped(any_keras_model: Path, tmp_path: Path):
115115

116116
# model_descr.weights.keras = ret_val
117117
# summary = test_model(model_descr, weight_format="keras_hdf5")
118-
# assert summary.status == "passed", summary.format()
118+
# assert summary.status == "passed", summary.display()

0 commit comments

Comments
 (0)