Skip to content

Commit fe09262

Browse files
test: fixing conditional skip for test fmus to account for glibc
1 parent f972bfd commit fe09262

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

tests/test_fmi.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import xml.etree.ElementTree as ET
2929
import re
3030
import platform
31+
from packaging import version
3132

3233
from pyfmi.fmi import (
3334
FMUException,
@@ -88,6 +89,14 @@ def solve(self):
8889
TEST_FMU_PATH = Path(file_path) / 'files' / 'test_fmus'
8990
TEST_FMU_FMI2_ME_PATH = TEST_FMU_PATH / '2.0' / 'me'
9091

92+
GLIBC_VERSION = platform.libc_ver()[1]
93+
94+
uses_test_fmus = pytest.mark.skipif(
95+
(platform.system() != "Linux") or
96+
(version.parse(GLIBC_VERSION) < version.parse("2.33")),
97+
reason = "Linux only binaries & requires glibc >= 2.33"
98+
)
99+
91100
# TODO: Many tests here could be parameterized
92101
# However, in many cases this relies on having FMUs with the same functionality
93102
# available for different FMI versions.
@@ -1667,7 +1676,7 @@ def test_load_xml(self, fmu_path, test_class):
16671676
model = test_class(fmu_path, _connect_dll=False)
16681677
assert model.get_name() == "CoupledClutches"
16691678

1670-
@pytest.mark.skipif(platform.system() != "Linux", reason = "Only Linux binaries")
1679+
@uses_test_fmus
16711680
@pytest.mark.parametrize("fmu_path",
16721681
[
16731682
TEST_FMU_FMI2_ME_PATH / "testModels_noStateAssertFailureFunctionLocalVariable.fmu",

0 commit comments

Comments
 (0)