Skip to content

Commit

Permalink
fix spec pin and test_bioimageio_spec_version
Browse files Browse the repository at this point in the history
FynnBe committed Nov 14, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent ef9f94b commit 06c27fc
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
],
packages=find_namespace_packages(exclude=["tests"]), # Required
install_requires=[
"bioimageio.spec==0.4.9.*",
"bioimageio.spec==0.4.9",
"imageio>=2.5",
"numpy",
"ruamel.yaml",
15 changes: 10 additions & 5 deletions tests/test_bioimageio_spec_version.py
Original file line number Diff line number Diff line change
@@ -26,11 +26,16 @@ def test_bioimageio_spec_version():
# get currently pinned bioimageio.spec version
meta = metadata("bioimageio.core")
req = meta["Requires-Dist"]
assert req.startswith("bioimageio.spec (==")
pmaj, pmin, ppatch, *asterisk_and_rest = req[len("bioimageio.spec (==") :].split(".")
assert asterisk_and_rest[0].startswith(
"*"
), "bioimageio.spec version should be pinned down to patch, e.g. '0.4.9.*'"
print(req)
assert req.startswith("bioimageio.spec ==")
spec_ver = req[len("bioimageio.spec ==") :]
assert spec_ver.count(".") == 2
pmaj, pmin, ppatchand_and_post = spec_ver.split(".")
assert (ppatchand_and_post.isdigit() or ppatchand_and_post[:-1].isdigit()) and (
ppatchand_and_post[-1] == "*" or ppatchand_and_post[-1].isdigit()
), "bioimageio.spec version should be pinned down to patch, e.g. '0.4.9*'"

ppatch = ppatchand_and_post[:-1] if ppatchand_and_post[-1] == "*" else ppatchand_and_post
pinned = Version(f"{pmaj}.{pmin}.{ppatch}")

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

0 comments on commit 06c27fc

Please sign in to comment.