Skip to content

Commit abf2b1e

Browse files
Merge pull request #290 from bioimage-io/fix_source_node_checker
Fix source node checker
2 parents 5a4599f + 9f771b1 commit abf2b1e

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

bioimageio/core/resource_io/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SourceNodeChecker(NodeVisitor):
2828
"""raises FileNotFoundError for unavailable URIs and paths"""
2929

3030
def __init__(self, *, root_path: os.PathLike):
31-
self.root_path = pathlib.Path(root_path).resolve()
31+
self.root_path = root_path if isinstance(root_path, raw_nodes.URI) else pathlib.Path(root_path).resolve()
3232

3333
def _visit_source(self, leaf: typing.Union[pathlib.Path, raw_nodes.URI]):
3434
if not source_available(leaf, self.root_path):

bioimageio/core/resource_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def _test_expected_resource_type(rd: ResourceDescription, expected_type: str) ->
228228
return dict(
229229
name="has expected resource type",
230230
status="passed" if has_expected_type else "failed",
231-
error=f"expected type {expected_type}, found {rd.type}",
231+
error=None if has_expected_type else f"expected type {expected_type}, found {rd.type}",
232232
traceback=None,
233233
source_name=rd.id or rd.name if hasattr(rd, "id") else rd.name,
234234
)

tests/test_resource_tests/test_test_model.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,14 @@ def test_validation_section_warning(unet2d_nuclei_broad_model, tmp_path: pathlib
5656
assert summary["name"] == "Test documentation completeness."
5757
assert summary["warnings"] == {}
5858
assert summary["status"] == "passed"
59+
60+
61+
def test_issue289():
62+
"""test for failure case from https://github.com/bioimage-io/core-bioimage-io-python/issues/289"""
63+
import bioimageio.core
64+
from bioimageio.core.resource_tests import test_model
65+
66+
doi = "10.5281/zenodo.6287342"
67+
model_resource = bioimageio.core.load_resource_description(doi)
68+
test_result = test_model(model_resource)
69+
assert all([t["status"] == "passed" for t in test_result])

0 commit comments

Comments
 (0)