Skip to content

Commit 4e069e9

Browse files
committed
update tests
1 parent 150ddce commit 4e069e9

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

tests/build_spec/test_build_spec.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import os
1+
from marshmallow import missing
2+
23
import bioimageio.spec as spec
34
from bioimageio.core import load_raw_resource_description, load_resource_description
45
from bioimageio.core.resource_io import nodes
56
from bioimageio.core.resource_io.utils import resolve_source
67
from bioimageio.core.resource_tests import test_model as _test_model
7-
from marshmallow import missing
88

99

1010
def _test_build_spec(
@@ -16,7 +16,6 @@ def _test_build_spec(
1616
use_implicit_output_shape=False,
1717
add_deepimagej_config=False,
1818
use_original_covers=False,
19-
use_absoloute_arch_path=False,
2019
training_data=None,
2120
parent=None,
2221
):
@@ -44,11 +43,6 @@ def _test_build_spec(
4443
if weight_type == "pytorch_state_dict":
4544
model_kwargs = None if weight_spec.kwargs is missing else weight_spec.kwargs
4645
architecture = str(weight_spec.architecture)
47-
if use_absoloute_arch_path:
48-
arch_path, cls_name = architecture.split(":")
49-
arch_path = os.path.abspath(os.path.join(root, arch_path))
50-
assert os.path.exists(arch_path)
51-
architecture = f"{arch_path}:{cls_name}"
5246
weight_type_ = None # the weight type can be auto-detected
5347
elif weight_type == "torchscript":
5448
architecture = None
@@ -233,10 +227,3 @@ def test_build_spec_deepimagej_keras(unet2d_keras, tmp_path):
233227
# test with original covers
234228
def test_build_spec_with_original_covers(unet2d_nuclei_broad_model, tmp_path):
235229
_test_build_spec(unet2d_nuclei_broad_model, tmp_path / "model.zip", "torchscript", use_original_covers=True)
236-
237-
238-
# test with absolute path for the architecture file
239-
def test_build_spec_abs_arch_path(unet2d_nuclei_broad_model, tmp_path):
240-
_test_build_spec(
241-
unet2d_nuclei_broad_model, tmp_path / "model.zip", "pytorch_state_dict", use_absoloute_arch_path=True
242-
)

tests/test_export_package.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def test_package_with_folder(unet2d_nuclei_broad_model):
3737
# alter package to have its documentation in a nested folder
3838
doc = model.documentation
3939
assert doc is not missing
40+
doc = doc.relative_to(model.root_path)
4041
assert not doc.is_absolute()
4142
new_doc = Path("nested") / "folder" / doc
4243
(package_folder / new_doc).parent.mkdir(parents=True)
@@ -55,5 +56,5 @@ def test_package_with_folder(unet2d_nuclei_broad_model):
5556
# load altered package
5657
reloaded_model = load_raw_resource_description(altered_package_folder / "rdf.yaml")
5758
assert isinstance(reloaded_model, raw_nodes.Model)
58-
assert reloaded_model.documentation == new_doc
59-
assert (altered_package_folder / reloaded_model.documentation).exists()
59+
assert reloaded_model.documentation.as_posix().endswith(new_doc.as_posix())
60+
assert reloaded_model.documentation.exists()

0 commit comments

Comments
 (0)