MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / asyncSetUp

Method asyncSetUp

test/asynchronous/test_session.py:89–105  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

87
88 @async_client_context.require_sessions
89 async def asyncSetUp(self):
90 await super().asyncSetUp()
91 # Create a second client so we can make sure clients cannot share
92 # sessions.
93 self.client2 = await self.async_rs_or_single_client()
94
95 # Redact no commands, so we can test user-admin commands have "lsid".
96 self.sensitive_commands = monitoring._SENSITIVE_COMMANDS.copy()
97 monitoring._SENSITIVE_COMMANDS.clear()
98
99 self.listener = SessionTestListener()
100 self.session_checker_listener = SessionTestListener()
101 self.client = await self.async_rs_or_single_client(
102 event_listeners=[self.listener, self.session_checker_listener]
103 )
104 self.db = self.client.pymongo_test
105 self.initial_lsids = {s["id"] for s in session_ids(self.client)}
106
107 async def asyncTearDown(self):
108 monitoring._SENSITIVE_COMMANDS.update(self.sensitive_commands)

Callers 2

asyncSetUpMethod · 0.45
asyncSetUpMethod · 0.45

Calls 5

copyMethod · 0.80
SessionTestListenerClass · 0.70
session_idsFunction · 0.70
clearMethod · 0.45

Tested by

no test coverage detected