

@testing.requires.sqlite
def test_plugin_registration(self):
    from sqlalchemy.dialects import sqlite
    global MyEnginePlugin

    def side_effect(url, kw):
        eq_(kw, {
            'logging_name': 'foob',
        })
        kw['logging_name'] = 'bar'
        return MyEnginePlugin
    MyEnginePlugin = Mock(side_effect=side_effect)
    plugins.register('engineplugin', __name__, 'MyEnginePlugin')
    e = create_engine('sqlite:///?plugin=engineplugin&foo=bar', logging_name='foob')
    eq_(e.dialect.name, 'sqlite')
    eq_(e.logging_name, 'bar')
    assert isinstance(e.dialect, sqlite.dialect)
    eq_(MyEnginePlugin.mock_calls, [call(e.url, {
        
    }), call.engine_created(e)])
    eq_(str(MyEnginePlugin.mock_calls[0][1][0]), 'sqlite:///?foo=bar')

dataset/ETHPy150Open zzzeek/sqlalchemy/test/engine/test_parseconnect.py TestRegNewDBAPI.test_plugin_registration/original