diff --git a/ibis/backends/duckdb/tests/snapshots/test_client/test_default_backend/out.sql b/ibis/backends/duckdb/tests/snapshots/test_client/test_default_backend/out.sql deleted file mode 100644 index 06687fb622f1..000000000000 --- a/ibis/backends/duckdb/tests/snapshots/test_client/test_default_backend/out.sql +++ /dev/null @@ -1,3 +0,0 @@ -SELECT - SUM(t0.a) AS "Sum(a)" -FROM ibis_pandas_memtable_fw3sdos5brerlgtmbkopvh334m AS t0 \ No newline at end of file diff --git a/ibis/backends/duckdb/tests/test_client.py b/ibis/backends/duckdb/tests/test_client.py index 061ff3809aa2..f2cfa5619568 100644 --- a/ibis/backends/duckdb/tests/test_client.py +++ b/ibis/backends/duckdb/tests/test_client.py @@ -1,6 +1,8 @@ from __future__ import annotations import os +import subprocess +import sys import duckdb import pandas as pd @@ -211,18 +213,27 @@ def test_insert_preserves_column_case(con): assert t1.count().execute() == 8 -def test_default_backend(snapshot): - df = pd.DataFrame({"a": [1, 2, 3]}) - t = ibis.memtable(df) - expr = t.a.sum() +def test_default_backend(): + # use subprocess to avoid mutating state across tests + script = """\ +import pandas as pd + +import ibis - # run this twice to ensure that we hit the optimizations in - # `_default_backend` - for _ in range(2): - assert expr.execute() == df.a.sum() +df = pd.DataFrame({"a": [1, 2, 3]}) - sql = ibis.to_sql(expr) - snapshot.assert_match(sql, "out.sql") +t = ibis.memtable(df) + +expr = t.a.sum() + +# run twice to ensure that we hit the optimizations in +# `_default_backend` +for _ in range(2): + assert expr.execute() == df.a.sum()""" + + assert ibis.options.default_backend is None + subprocess.run([sys.executable, "-c", script], check=True) + assert ibis.options.default_backend is None @pytest.mark.parametrize(