Skip to content

Commit

Permalink
tests/usb: Check the result of running umockdev and matching the output
Browse files Browse the repository at this point in the history
This also makes mypy happy.
  • Loading branch information
swick committed Jan 24, 2025
1 parent d2781c0 commit 0024f6c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/test_usb.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ def umockdev_has_working_remove():
required = (0, 18, 4)

result = subprocess.run(["umockdev-run", "--version"], stdout=subprocess.PIPE)
if result.returncode != 0:
return False
match = re.match(r"^(\d+)\.(\d+)\.(\d+)", result.stdout.decode("UTF-8").strip())
if not match:
return False
version = tuple(map(int, match.groups()))
return version >= required

Expand Down

0 comments on commit 0024f6c

Please sign in to comment.