mirror of
https://github.com/sezanzeb/input-remapper
synced 2024-11-08 07:10:36 +00:00
made injector constructor test safer
This commit is contained in:
parent
3fcc5af310
commit
273b18bcab
@ -104,10 +104,19 @@ class TestInjector(unittest.TestCase):
|
|||||||
# already be enough
|
# already be enough
|
||||||
pending_events['device 2'] = [Event(1, 1, 1)] * 10
|
pending_events['device 2'] = [Event(1, 1, 1)] * 10
|
||||||
|
|
||||||
|
injector2 = None
|
||||||
|
try:
|
||||||
injector2 = KeycodeInjector('device 2')
|
injector2 = KeycodeInjector('device 2')
|
||||||
self.assertEqual(len(injector2.processes), 1)
|
self.assertEqual(len(injector2.processes), 1)
|
||||||
self.assertEqual(injector2.processes[0].is_alive(), True)
|
self.assertEqual(injector2.processes[0].is_alive(), True)
|
||||||
injector2.processes[0].join()
|
injector2.processes[0].join()
|
||||||
|
except Exception as e:
|
||||||
|
# make sure to not cause race conditions for other tests
|
||||||
|
# if this test fails
|
||||||
|
if injector2 is not None:
|
||||||
|
for p in injector2.processes:
|
||||||
|
p.join()
|
||||||
|
raise e
|
||||||
|
|
||||||
def test_injector(self):
|
def test_injector(self):
|
||||||
device = get_devices()['device 2']
|
device = get_devices()['device 2']
|
||||||
|
Loading…
Reference in New Issue
Block a user