(self, *args, **kwargs)
| 248 | return getattr(self.dbapi, key) |
| 249 | |
| 250 | def connect(self, *args, **kwargs): |
| 251 | conn = self.dbapi.connect(*args, **kwargs) |
| 252 | if self.is_stopped: |
| 253 | self._safe(conn.close) |
| 254 | curs = conn.cursor() # should fail on Oracle etc. |
| 255 | # should fail for everything that didn't fail |
| 256 | # above, connection is closed |
| 257 | curs.execute("select 1") |
| 258 | assert False, "simulated connect failure didn't work" |
| 259 | else: |
| 260 | self.connections.append(conn) |
| 261 | return conn |
| 262 | |
| 263 | def _safe(self, fn): |
| 264 | try: |