MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_wrapper_hooks

Method test_wrapper_hooks

test/engine/test_parseconnect.py:998–1022  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

996
997 @testing.requires.sqlite
998 def test_wrapper_hooks(self):
999 def get_dialect_cls(url):
1000 url = url.set(drivername="sqlite")
1001 return url.get_dialect()
1002
1003 global WrapperFactory
1004 WrapperFactory = Mock()
1005 WrapperFactory.get_dialect_cls.side_effect = get_dialect_cls
1006
1007 registry.register("wrapperdialect", __name__, "WrapperFactory")
1008
1009 from sqlalchemy.dialects import sqlite
1010
1011 e = create_engine("wrapperdialect://")
1012
1013 eq_(e.dialect.name, "sqlite")
1014 assert isinstance(e.dialect, sqlite.dialect)
1015
1016 eq_(
1017 WrapperFactory.mock_calls,
1018 [
1019 call.get_dialect_cls(url.make_url("wrapperdialect://")),
1020 call.engine_created(e),
1021 ],
1022 )
1023
1024 @testing.requires.sqlite
1025 def test_plugin_url_registration(self):

Callers

nothing calls this directly

Calls 5

create_engineFunction · 0.90
eq_Function · 0.90
registerMethod · 0.45
get_dialect_clsMethod · 0.45
engine_createdMethod · 0.45

Tested by

no test coverage detected