Skip to content
Snippets Groups Projects
Commit baba13f0 authored by Peter Hutterer's avatar Peter Hutterer
Browse files

test: skip local device tests if we don't have local devices


These break when running offa custom VM that may not have any local devices at
all.

Signed-off-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 48d78466
No related branches found
No related tags found
1 merge request!15Run the test suite in KVM runners
......@@ -2,6 +2,7 @@ import os
import unittest
import ctypes
from libevdev._clib import Libevdev, UinputDevice
from pathlib import Path
# Note: these tests test for the correct functioning of the python bindings,
# not of libevdev underneath. Some ranges are hardcoded for simplicity, e.g.
......@@ -13,6 +14,10 @@ def is_root():
return os.getuid() == 0
def has_event_devices():
return list(Path('/dev/input/').glob('event*'))
class TestNameConversion(unittest.TestCase):
def test_type_max(self):
......@@ -225,6 +230,7 @@ class TestLibevdevDevice(unittest.TestCase):
self.assertEqual(id["version"], 5)
@unittest.skipUnless(has_event_devices(), 'Local event devices required')
class TestRealDevice(unittest.TestCase):
"""
Tests various things against /dev/input/event3 which is usually the
......@@ -492,6 +498,7 @@ class TestAbsDevice(unittest.TestCase):
self.assertTrue(dev.has_property("INPUT_PROP_ACCELEROMETER"))
@unittest.skipUnless(has_event_devices(), 'Local event devices required')
class TestMTDevice(unittest.TestCase):
"""
Tests various things against the first MT device found.
......@@ -530,6 +537,7 @@ class TestMTDevice(unittest.TestCase):
@unittest.skipUnless(is_root(), 'Test requires root')
def test_slot_value(self):
dev = Libevdev(self.fd)
a = dev.absinfo("ABS_MT_POSITION_X")
v = dev.slot_value(dev.current_slot, "ABS_MT_POSITION_X")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment