fixed tests

xkb
sezanzeb 4 years ago committed by sezanzeb
parent 34f0bee458
commit 0085ff4dd5

@ -89,6 +89,8 @@ class KeycodeInjector:
make running multiple injector easier. There is one procss per
hardware-device that is being mapped.
"""
regrab_timeout = 0.5
def __init__(self, device, mapping):
"""Start injecting keycodes based on custom_mapping.
@ -198,7 +200,7 @@ class KeycodeInjector:
logger.error('Cannot grab %s, it is possibly in use', path)
return None, False
time.sleep(0.5)
time.sleep(self.regrab_timeout)
return device, abs_to_rel

@ -37,6 +37,7 @@ gi.require_version('Gtk', '3.0')
gi.require_version('GLib', '2.0')
from keymapper.logger import update_verbosity
from keymapper.dev.injector import KeycodeInjector
assert not os.getcwd().endswith('tests')
@ -281,6 +282,9 @@ def patch_evdev():
self.device = InputDevice('/dev/input/event40')
pass
def capabilities(self, *args, **kwargs):
return []
def write(self, type, code, value):
self.write_count += 1
event = InputEvent(type, code, value)
@ -317,6 +321,10 @@ patch_unsaved()
patch_select()
# no need for a high number in tests
KeycodeInjector.regrab_timeout = 0.15
def main():
update_verbosity(True)

@ -67,6 +67,9 @@ class TestKeycodeMapper(unittest.TestCase):
def write(self, type, code, value):
history.append((type, code, value))
def capabilities(self, *args, **kwargs):
return []
def syn(self):
pass

Loading…
Cancel
Save