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

Method test_close

test/orm/test_session.py:151–165  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

149 c.exec_driver_sql("select * from users")
150
151 def test_close(self):
152 """close() doesn't close a connection the session didn't open"""
153
154 User, users = self.classes.User, self.tables.users
155
156 c = testing.db.connect()
157 c.exec_driver_sql("select * from users")
158
159 self.mapper_registry.map_imperatively(User, users)
160 s = Session(bind=c)
161 s.add(User(name="first"))
162 s.flush()
163 c.exec_driver_sql("select * from users")
164 s.close()
165 c.exec_driver_sql("select * from users")
166
167 def test_autobegin_execute(self):
168 # 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