| 389 | |
| 390 | |
| 391 | def tearDown(test): |
| 392 | # drop leftover tables after each test |
| 393 | with connect(crate.http_url) as conn: |
| 394 | c = conn.cursor() |
| 395 | c.execute(""" |
| 396 | SELECT table_schema, table_name |
| 397 | FROM information_schema.tables |
| 398 | WHERE table_schema NOT IN ('blob', 'sys', 'information_schema', 'pg_catalog') |
| 399 | """) |
| 400 | for schema, table in c.fetchall(): |
| 401 | try: |
| 402 | c.execute(""" |
| 403 | DROP TABLE IF EXISTS "{}"."{}" |
| 404 | """.format(schema, table)) |
| 405 | except Exception as e: |
| 406 | print('Failed to drop table {}.{}: {}'.format(schema, table, e)) |
| 407 | |
| 408 | |
| 409 | docsuite = partial(doctest.DocFileSuite, |