Skip to content

Commit 06c27fc

Browse files
committed
fix spec pin and test_bioimageio_spec_version
1 parent ef9f94b commit 06c27fc

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
],
2727
packages=find_namespace_packages(exclude=["tests"]), # Required
2828
install_requires=[
29-
"bioimageio.spec==0.4.9.*",
29+
"bioimageio.spec==0.4.9",
3030
"imageio>=2.5",
3131
"numpy",
3232
"ruamel.yaml",

tests/test_bioimageio_spec_version.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,16 @@ def test_bioimageio_spec_version():
2626
# get currently pinned bioimageio.spec version
2727
meta = metadata("bioimageio.core")
2828
req = meta["Requires-Dist"]
29-
assert req.startswith("bioimageio.spec (==")
30-
pmaj, pmin, ppatch, *asterisk_and_rest = req[len("bioimageio.spec (==") :].split(".")
31-
assert asterisk_and_rest[0].startswith(
32-
"*"
33-
), "bioimageio.spec version should be pinned down to patch, e.g. '0.4.9.*'"
29+
print(req)
30+
assert req.startswith("bioimageio.spec ==")
31+
spec_ver = req[len("bioimageio.spec ==") :]
32+
assert spec_ver.count(".") == 2
33+
pmaj, pmin, ppatchand_and_post = spec_ver.split(".")
34+
assert (ppatchand_and_post.isdigit() or ppatchand_and_post[:-1].isdigit()) and (
35+
ppatchand_and_post[-1] == "*" or ppatchand_and_post[-1].isdigit()
36+
), "bioimageio.spec version should be pinned down to patch, e.g. '0.4.9*'"
37+
38+
ppatch = ppatchand_and_post[:-1] if ppatchand_and_post[-1] == "*" else ppatchand_and_post
3439
pinned = Version(f"{pmaj}.{pmin}.{ppatch}")
3540

3641
assert pinned >= released, "bioimageio.spec pinned to an old version!"

0 commit comments

Comments
 (0)