test: if we fail to load liboeffis.so, skip the rest of the pytests

This gives us a nicer behavior when (semi-intentionally) running pytest
in the source directory.
This commit is contained in:
Peter Hutterer 2023-04-06 12:01:03 +10:00
parent 6179c91580
commit 4b77664dc1

View file

@ -422,3 +422,11 @@ def test_version_compare():
assert not version_at_least("1.0", "1.1")
assert not version_at_least("1.0.2", "1.0.3")
assert not version_at_least("1.0.2.dev1234", "1.0.3")
# Try loading the instance once, if that fails we're probably in
# the source directory so let's skip everything.
try:
LibOeffis.instance()
except OSError:
pytest.skip(allow_module_level=True)