Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
max-sixty committed Jan 22, 2024
1 parent 04143fd commit b2547c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
14 changes: 14 additions & 0 deletions xarray/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pandas as pd
import pytest

import xarray as xr
from xarray import DataArray, Dataset
from xarray.tests import create_test_data, requires_dask

Expand All @@ -13,6 +14,19 @@ def backend(request):
return request.param


@pytest.fixture(params=["numbagg", "bottleneck"])
def compute_backend(request):
if request.param == "bottleneck":
options = dict(use_bottleneck=True, use_numbagg=False)
elif request.param == "numbagg":
options = dict(use_bottleneck=False, use_numbagg=True)
else:
raise ValueError

with xr.set_options(**options):
yield request.param


@pytest.fixture(params=[1])
def ds(request, backend):
if request.param == 1:
Expand Down
12 changes: 0 additions & 12 deletions xarray/tests/test_rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@
]


@pytest.fixture(params=["numbagg", "bottleneck"])
def compute_backend(request):
if request.param == "bottleneck":
options = dict(use_bottleneck=True, use_numbagg=False)
elif request.param == "numbagg":
options = dict(use_bottleneck=False, use_numbagg=True)
else:
raise ValueError

with xr.set_options(**options):
yield request.param


@pytest.mark.parametrize("func", ["mean", "sum"])
@pytest.mark.parametrize("min_periods", [1, 10])
Expand Down
3 changes: 2 additions & 1 deletion xarray/tests/test_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,8 @@ def test_reduce(self):
v.mean(dim="x", axis=0)

@requires_bottleneck
def test_reduce_use_bottleneck(self, monkeypatch):
@pytest.mark.parametrize("compute_backend", ["bottleneck"], indirect=True)
def test_reduce_use_bottleneck(self, monkeypatch, compute_backend):
def raise_if_called(*args, **kwargs):
raise RuntimeError("should not have been called")

Expand Down

0 comments on commit b2547c9

Please sign in to comment.