Skip to content

Commit 1d6628f

Browse files
whotBenjamin Tissoires
authored andcommitted
selftests/hid: require hidtools 0.12
Not all our tests really require it but since it's likely pip-installed anyway it's trivial to require the new version, just in case we want to start cleaning up other bits. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
1 parent 2b29a90 commit 1d6628f

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tools/testing/selftests/hid/tests/conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# Copyright (c) 2017 Benjamin Tissoires <benjamin.tissoires@gmail.com>
66
# Copyright (c) 2017 Red Hat, Inc.
77

8+
from packaging.version import Version
89
import platform
910
import pytest
1011
import re
@@ -14,6 +15,19 @@
1415
from pathlib import Path
1516

1617

18+
@pytest.fixture(autouse=True)
19+
def hidtools_version_check():
20+
HIDTOOLS_VERSION = "0.12"
21+
try:
22+
import hidtools
23+
24+
version = hidtools.__version__ # type: ignore
25+
if Version(version) < Version(HIDTOOLS_VERSION):
26+
pytest.skip(reason=f"have hidtools {version}, require >={HIDTOOLS_VERSION}")
27+
except Exception:
28+
pytest.skip(reason=f"hidtools >={HIDTOOLS_VERSION} required")
29+
30+
1731
# See the comment in HIDTestUdevRule, this doesn't set up but it will clean
1832
# up once the last test exited.
1933
@pytest.fixture(autouse=True, scope="session")

0 commit comments

Comments
 (0)