Skip to content

Commit

Permalink
make DEFAULT_CONSTRUCTORS configurable via environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Jan 1, 2025
1 parent bb4df68 commit 54f1864
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@
from narwhals.typing import IntoDataFrame
from narwhals.typing import IntoFrame


if TYPE_CHECKING:
from pyspark.sql import SparkSession

from narwhals.typing import IntoDataFrame
from narwhals.typing import IntoFrame

# When testing cudf.pandas in Kaggle, we get an error if we try to run
# python -m cudf.pandas -m pytest --constructors=pandas. This gives us
# a way to run `python -m cudf.pandas -m pytest` and control which constructors
# get tested.
if default_constructors := os.environ.get("NARWHALS_DEFAULT_CONSTRUCTORS", None):
DEFAULT_CONSTRUCTORS = default_constructors
else:
DEFAULT_CONSTRUCTORS = (
"pandas,pandas[nullable],pandas[pyarrow],polars[eager],polars[lazy],pyarrow"
)


def pytest_addoption(parser: Any) -> None:
parser.addoption(
Expand All @@ -36,7 +46,7 @@ def pytest_addoption(parser: Any) -> None:
parser.addoption(
"--constructors",
action="store",
default="pandas,pandas[nullable],pandas[pyarrow],polars[eager],polars[lazy],pyarrow",
default=DEFAULT_CONSTRUCTORS,
type=str,
help="libraries to test",
)
Expand Down

0 comments on commit 54f1864

Please sign in to comment.