Skip to content

Commit 150d8be

Browse files
committed
dont skip tests if polars isnt installed
1 parent fe54feb commit 150d8be

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

conftest.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,21 @@
2323

2424

2525
@pytest.fixture(scope="session")
26-
def polars_session():
27-
pytest.importorskip("polars")
26+
def polars_session_or_bpd():
27+
# Since the doctest imports fixture is autouse=True, don't skip if polars
28+
# isn't available.
29+
try:
30+
from bigframes.testing import polars_session
2831

29-
from bigframes.testing import polars_session
32+
return polars_session.TestSession()
33+
except ImportError:
34+
import bigframes.pandas as bpd
3035

31-
return polars_session.TestSession()
36+
return bpd
3237

3338

3439
@pytest.fixture(autouse=True)
35-
def default_doctest_imports(doctest_namespace, polars_session):
40+
def default_doctest_imports(doctest_namespace, polars_session_or_bpd):
3641
"""
3742
Avoid some boilerplate in pandas-inspired tests.
3843
@@ -41,5 +46,5 @@ def default_doctest_imports(doctest_namespace, polars_session):
4146
doctest_namespace["np"] = np
4247
doctest_namespace["pd"] = pd
4348
doctest_namespace["pa"] = pa
44-
doctest_namespace["bpd"] = polars_session
49+
doctest_namespace["bpd"] = polars_session_or_bpd
4550
bigframes._config.options.display.progress_bar = None

0 commit comments

Comments
 (0)