From 0e6a79eef1259e48aef726865e2299690bf41962 Mon Sep 17 00:00:00 2001 From: Hailin Wang Date: Sun, 23 Jun 2024 18:49:33 +0800 Subject: [PATCH] Add test to check binder and llvm versions --- python/pyproject.toml | 2 ++ python/tests/test_binder.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 python/tests/test_binder.py diff --git a/python/pyproject.toml b/python/pyproject.toml index c4fc27e3..005c0e8d 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -73,6 +73,8 @@ version = "${version}" [tool.cibuildwheel] build = "cp312-*" +test-requires = ["pytest", "packaging"] +test-command = "pytest {package}/tests" musllinux-x86_64-image = "musllinux_1_1" musllinux-i686-image = "musllinux_1_1" musllinux-aarch64-image = "musllinux_1_1" diff --git a/python/tests/test_binder.py b/python/tests/test_binder.py new file mode 100644 index 00000000..a0d390ac --- /dev/null +++ b/python/tests/test_binder.py @@ -0,0 +1,17 @@ +import re +import subprocess + +from binder import __version__ +from packaging.version import Version + + +def test_check_binder_llvm_version(): + # Check the output of the `binder -version` command to obtain the versions of Binder and LLVM + output = subprocess.check_output(["binder", "-version"]).decode() + pattern = r"binder ([\d\.]+)\nLLVM ([\d\.]+)" + binder_version, llvm_version = re.match(pattern, output).groups() + + # Check the versions of Binder and LLVM + binder_base_version = Version(__version__).base_version + assert binder_base_version == binder_version, f"Binder version mismatch: {binder_base_version} != {binder_version}" + assert llvm_version == "6.0.1", f"LLVM version mismatch: {llvm_version} != 6.0.1"