MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_wrapper_hooks

Method test_wrapper_hooks

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

Source from the content-addressed store, hash-verified

1009
1010 @testing.requires.sqlite
1011 def test_wrapper_hooks(self):
1012 def get_dialect_cls(url):
1013 url = url.set(drivername="sqlite")
1014 return url.get_dialect()
1015
1016 global WrapperFactory
1017 WrapperFactory = Mock()
1018 WrapperFactory.get_dialect_cls.side_effect = get_dialect_cls
1019
1020 registry.register("wrapperdialect", __name__, "WrapperFactory")
1021
1022 from sqlalchemy.dialects import sqlite
1023
1024 e = create_engine("wrapperdialect://")
1025
1026 eq_(e.dialect.name, "sqlite")
1027 assert isinstance(e.dialect, sqlite.dialect)
1028
1029 eq_(
1030 WrapperFactory.mock_calls,
1031 [
1032 call.get_dialect_cls(url.make_url("wrapperdialect://")),
1033 call.engine_created(e),
1034 ],
1035 )
1036
1037 @testing.requires.sqlite
1038 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