MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_no_close_on_flush

Method test_no_close_on_flush

test/orm/test_session.py:155–167  ·  view source on GitHub ↗

Flush() doesn't close a connection the session didn't open

(self)

Source from the content-addressed store, hash-verified

153 __prefer_requires__ = ("independent_connections",)
154
155 def test_no_close_on_flush(self):
156 """Flush() doesn't close a connection the session didn't open"""
157
158 User, users = self.classes.User, self.tables.users
159
160 c = testing.db.connect()
161 c.exec_driver_sql("select * from users")
162
163 self.mapper_registry.map_imperatively(User, users)
164 s = Session(bind=c)
165 s.add(User(name="first"))
166 s.flush()
167 c.exec_driver_sql("select * from users")
168
169 def test_close(self):
170 """close() doesn't close a connection the session didn't open"""

Callers

nothing calls this directly

Calls 7

addMethod · 0.95
flushMethod · 0.95
SessionClass · 0.90
map_imperativelyMethod · 0.80
UserClass · 0.70
connectMethod · 0.45
exec_driver_sqlMethod · 0.45

Tested by

no test coverage detected