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

Method _fixture

test/sql/test_metadata.py:5088–5117  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5086class DialectKWArgTest(fixtures.TestBase):
5087 @contextmanager
5088 def _fixture(self):
5089 from sqlalchemy.engine.default import DefaultDialect
5090
5091 class ParticipatingDialect(DefaultDialect):
5092 construct_arguments = [
5093 (schema.Index, {"x": 5, "y": False, "z_one": None}),
5094 (schema.ForeignKeyConstraint, {"foobar": False}),
5095 ]
5096
5097 class ParticipatingDialect2(DefaultDialect):
5098 construct_arguments = [
5099 (schema.Index, {"x": 9, "y": True, "pp": "default"}),
5100 (schema.Table, {"*": None}),
5101 ]
5102
5103 class NonParticipatingDialect(DefaultDialect):
5104 construct_arguments = None
5105
5106 def load(dialect_name):
5107 if dialect_name == "participating":
5108 return ParticipatingDialect
5109 elif dialect_name == "participating2":
5110 return ParticipatingDialect2
5111 elif dialect_name == "nonparticipating":
5112 return NonParticipatingDialect
5113 else:
5114 raise exc.NoSuchModuleError("no dialect %r" % dialect_name)
5115
5116 with mock.patch("sqlalchemy.dialects.registry.load", load):
5117 yield
5118
5119 def teardown_test(self):
5120 Index._kw_registry.clear()

Calls

no outgoing calls

Tested by

no test coverage detected