MCPcopy Create free account
hub / github.com/alphagov/notifications-api / __enter__

Method __enter__

tests/utils.py:21–27  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

19 self._listeners: list[Callable] = []
20
21 def __enter__(self):
22 # Register listeners for all engines to capture bind_key
23 for bind_key, engine in db.engines.items():
24 listener = self._listener(bind_key)
25 event.listen(engine, "before_cursor_execute", listener)
26 self._listeners.append((engine, listener))
27 return self
28
29 def __exit__(self, exc_type, exc_val, exc_tb):
30 # Remove all listeners

Callers

nothing calls this directly

Calls 1

_listenerMethod · 0.95

Tested by

no test coverage detected