MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_close

Method test_close

test/orm/test_session.py:169–183  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

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"""
171
172 User, users = self.classes.User, self.tables.users
173
174 c = testing.db.connect()
175 c.exec_driver_sql("select * from users")
176
177 self.mapper_registry.map_imperatively(User, users)
178 s = Session(bind=c)
179 s.add(User(name="first"))
180 s.flush()
181 c.exec_driver_sql("select * from users")
182 s.close()
183 c.exec_driver_sql("select * from users")
184
185 def test_autobegin_execute(self):
186 # test the new autobegin behavior introduced in #5074

Callers

nothing calls this directly

Calls 8

addMethod · 0.95
flushMethod · 0.95
closeMethod · 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