|
| 1 | +# Copyright 2025 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +from __future__ import annotations |
| 16 | + |
| 17 | +import numpy as np |
| 18 | +import pandas as pd |
| 19 | +import pyarrow as pa |
| 20 | +import pytest |
| 21 | + |
| 22 | +import bigframes._config |
| 23 | + |
| 24 | + |
| 25 | +@pytest.fixture(scope="session") |
| 26 | +def polars_session(): |
| 27 | + pytest.importorskip("polars") |
| 28 | + |
| 29 | + from bigframes.testing import polars_session |
| 30 | + |
| 31 | + return polars_session.TestSession() |
| 32 | + |
| 33 | + |
| 34 | +@pytest.fixture(autouse=True) |
| 35 | +def default_doctest_imports(doctest_namespace, polars_session): |
| 36 | + """ |
| 37 | + Avoid some boilerplate in pandas-inspired tests. |
| 38 | +
|
| 39 | + See: https://docs.pytest.org/en/stable/how-to/doctest.html#doctest-namespace-fixture |
| 40 | + """ |
| 41 | + doctest_namespace["np"] = np |
| 42 | + doctest_namespace["pd"] = pd |
| 43 | + doctest_namespace["pa"] = pa |
| 44 | + doctest_namespace["bpd"] = polars_session |
| 45 | + bigframes._config.options.display.progress_bar = None |
0 commit comments