def test_uninstrument_connection(self): connection = mock.Mock() # Set connection.database to avoid a failure because mock can't # be concatenated connection.database = "-" connection2 = wrappers.instrument_connection(self.tracer, connection, "-") self.assertIs(connection2.__wrapped__, connection) connection3 = wrappers.uninstrument_connection(connection2) self.assertIs(connection3, connection) with self.assertLogs(level=logging.WARNING): connection4 = wrappers.uninstrument_connection(connection) self.assertIs(connection4, connection)
def uninstrument_connection(self, connection): """Disable instrumentation in a aiopg connection. Args: connection: The connection to uninstrument. Returns: An uninstrumented connection. """ return wrappers.uninstrument_connection(connection)