some proper cleanup of pending_events

This commit is contained in:
sezanzeb 2020-11-22 15:17:55 +01:00
parent 76cc37b867
commit a8939e6051
3 changed files with 7 additions and 1 deletions

View File

@ -221,6 +221,7 @@ if __name__ == "__main__":
originalStartTest = unittest.TextTestResult.startTest originalStartTest = unittest.TextTestResult.startTest
def startTest(self, test): def startTest(self, test):
originalStartTest(self, test) originalStartTest(self, test)
print()
unittest.TextTestResult.startTest = startTest unittest.TextTestResult.startTest = startTest
testrunner = unittest.TextTestRunner(verbosity=2).run(testsuite) testrunner = unittest.TextTestRunner(verbosity=2).run(testsuite)

View File

@ -53,7 +53,8 @@ class TestInjector(unittest.TestCase):
self.injector.stop_injecting() self.injector.stop_injecting()
self.injector = None self.injector = None
evdev.InputDevice.grab = self.grab evdev.InputDevice.grab = self.grab
pending_events['device 2'] = [] if pending_events.get('device 2') is not None:
del pending_events['device 2']
def test_modify_capabilities(self): def test_modify_capabilities(self):
class FakeDevice: class FakeDevice:

View File

@ -36,6 +36,10 @@ CODE_3 = 102
class TestReader(unittest.TestCase): class TestReader(unittest.TestCase):
def tearDown(self): def tearDown(self):
keycode_reader.clear() keycode_reader.clear()
if pending_events.get('device 1') is not None:
del pending_events['device 1']
if pending_events.get('device 2') is not None:
del pending_events['device 2']
def test_reading(self): def test_reading(self):
keycode_reader.start_reading('device 1') keycode_reader.start_reading('device 1')