Skip to content

Commit

Permalink
Add --executor to pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
pentschev committed Nov 14, 2024
1 parent bf182e4 commit 2b74f28
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/cudf_polars/cudf_polars/testing/asserts.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
__all__: list[str] = ["assert_gpu_result_equal", "assert_ir_translation_raises"]


# Will be overriden by `conftest.py` with the value from the `--executor`
# command-line argument
Executor = None


def assert_gpu_result_equal(
lazydf: pl.LazyFrame,
*,
Expand Down Expand Up @@ -84,7 +89,7 @@ def assert_gpu_result_equal(
)

expect = lazydf.collect(**final_polars_collect_kwargs)
engine = GPUEngine(raise_on_fail=True, executor=executor)
engine = GPUEngine(raise_on_fail=True, executor=Executor)
got = lazydf.collect(**final_cudf_collect_kwargs, engine=engine)
assert_frame_equal(
expect,
Expand Down
16 changes: 16 additions & 0 deletions python/cudf_polars/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,19 @@
@pytest.fixture(params=[False, True], ids=["no_nulls", "nulls"], scope="session")
def with_nulls(request):
return request.param


def pytest_addoption(parser):
parser.addoption(
"--executor",
action="store",
default="cudf",
choices=("cudf", "dask-experimental"),
help="Executor to use for GPUEngine.",
)


def pytest_configure(config):
import cudf_polars.testing.asserts

cudf_polars.testing.asserts.Executor = config.getoption("--executor")

0 comments on commit 2b74f28

Please sign in to comment.