MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / close_all_sessions

Function close_all_sessions

lib/sqlalchemy/orm/session.py:5330–5343  ·  view source on GitHub ↗

Close all sessions in memory. This function consults a global registry of all :class:`.Session` objects and calls :meth:`.Session.close` on them, which resets them to a clean state. This function is not for general use but may be useful for test suites within the teardown schem

()

Source from the content-addressed store, hash-verified

5328
5329
5330def close_all_sessions() -> None:
5331 """Close all sessions in memory.
5332
5333 This function consults a global registry of all :class:`.Session` objects
5334 and calls :meth:`.Session.close` on them, which resets them to a clean
5335 state.
5336
5337 This function is not for general use but may be useful for test suites
5338 within the teardown scheme.
5339
5340 """
5341
5342 for sess in _sessions.values():
5343 sess.close()
5344
5345
5346def make_transient(instance: object) -> None:

Callers 8

teardown_testMethod · 0.90
test_integrateMethod · 0.90
test_integrateMethod · 0.90
teardown_testMethod · 0.90
teardown_testMethod · 0.90
teardown_testMethod · 0.90

Calls 2

valuesMethod · 0.45
closeMethod · 0.45

Tested by 8

teardown_testMethod · 0.72
test_integrateMethod · 0.72
test_integrateMethod · 0.72
teardown_testMethod · 0.72
teardown_testMethod · 0.72
teardown_testMethod · 0.72