@pytest.fixture
def fake_keyconfig():
 bindings = dict(BINDINGS)
 fake_keyconfig = mock.Mock(spec=['get_bindings_for'])
 fake_keyconfig.get_bindings_for.side_effect = (lambda s: bindings[s])
 objreg.register('key-config', fake_keyconfig)
 (yield bindings)
 objreg.delete('key-config')

@ pytest . fixture def fake_keyconfig ( ) : bindings = dict ( BINDINGS ) fake_keyconfig = mock . Mock ( spec = [ 'get_bindings_for' ] ) fake_keyconfig . get_bindings_for . side_effect = ( lambda s : bindings [ s ] ) objreg . register ( 'key-config' , fake_keyconfig ) ( yield bindings ) objreg . delete ( 'key-config' )
create a mock of a keyconfiguration and register it into objreg .