Skip to content

Commit

Permalink
test(clickhouse): clean up unconditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Oct 9, 2024
1 parent 0b9ca54 commit c92a4fa
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions ibis/backends/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1360,26 +1360,26 @@ def test_overwrite(ddl_con, monkeypatch):
assert t2.count().execute() == expected_count


@contextlib.contextmanager
def create_and_destroy_db(con):
con.create_database(dbname := gen_name("db"))
try:
yield dbname
finally:
con.drop_database(dbname)
@pytest.fixture(scope="session")
def tmp_db(con_create_database):
con_create_database.create_database(dbname := gen_name("db"))
yield dbname
con_create_database.drop_database(dbname)


# TODO: move this to something like `test_ddl.py`
def test_insert_with_database_specified(con_create_database):
def test_insert_with_database_specified(con_create_database, tmp_db):
con = con_create_database

t = ibis.memtable({"a": [1, 2, 3]})

with create_and_destroy_db(con) as dbname:
con.create_table(table_name := gen_name("table"), obj=t, database=dbname)
con.insert(table_name, obj=t, database=dbname)
assert con.table(table_name, database=dbname).count().to_pandas() == 6
con.drop_table(table_name, database=dbname)
con.create_table(table_name := gen_name("table"), obj=t, database=tmp_db)

try:
con.insert(table_name, obj=t, database=tmp_db)
assert con.table(table_name, database=tmp_db).count().to_pandas() == 6
finally:
con.drop_table(table_name, database=tmp_db)


@pytest.mark.notyet(["datafusion"], reason="cannot list or drop catalogs")
Expand Down

0 comments on commit c92a4fa

Please sign in to comment.