mirror of
https://github.com/sezanzeb/input-remapper
synced 2024-11-04 12:00:16 +00:00
improved get_devices test
This commit is contained in:
parent
09cec4cfac
commit
121f6900d8
@ -150,7 +150,6 @@ class GetDevicesProcess(multiprocessing.Process):
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.pipe.send(result)
|
self.pipe.send(result)
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def get_devices():
|
def get_devices():
|
||||||
|
@ -27,13 +27,16 @@ from keymapper.linux import GetDevicesProcess
|
|||||||
class TestLinux(unittest.TestCase):
|
class TestLinux(unittest.TestCase):
|
||||||
def test_create_preset_1(self):
|
def test_create_preset_1(self):
|
||||||
class FakePipe:
|
class FakePipe:
|
||||||
def send(self, stuff):
|
devices = None
|
||||||
pass
|
|
||||||
|
def send(self, devices):
|
||||||
|
self.devices = devices
|
||||||
|
|
||||||
# don't actually start the process, just use the `run` function.
|
# don't actually start the process, just use the `run` function.
|
||||||
# otherwise the coverage tool can't keep track.
|
# otherwise the coverage tool can't keep track.
|
||||||
devices = GetDevicesProcess(FakePipe()).run()
|
pipe = FakePipe()
|
||||||
self.assertDictEqual(devices, {
|
GetDevicesProcess(pipe).run()
|
||||||
|
self.assertDictEqual(pipe.devices, {
|
||||||
'device 1': {
|
'device 1': {
|
||||||
'paths': [
|
'paths': [
|
||||||
'/dev/input/event11',
|
'/dev/input/event11',
|
||||||
|
Loading…
Reference in New Issue
Block a user