improved get_devices test

xkb
sezanzeb 4 years ago committed by sezanzeb
parent 899e624071
commit efce80a911

@ -150,7 +150,6 @@ class GetDevicesProcess(multiprocessing.Process):
}
self.pipe.send(result)
return result
def get_devices():

@ -27,13 +27,16 @@ from keymapper.linux import GetDevicesProcess
class TestLinux(unittest.TestCase):
def test_create_preset_1(self):
class FakePipe:
def send(self, stuff):
pass
devices = None
def send(self, devices):
self.devices = devices
# don't actually start the process, just use the `run` function.
# otherwise the coverage tool can't keep track.
devices = GetDevicesProcess(FakePipe()).run()
self.assertDictEqual(devices, {
pipe = FakePipe()
GetDevicesProcess(pipe).run()
self.assertDictEqual(pipe.devices, {
'device 1': {
'paths': [
'/dev/input/event11',

Loading…
Cancel
Save