-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathconftest.py
More file actions
30 lines (20 loc) · 816 Bytes
/
conftest.py
File metadata and controls
30 lines (20 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
collect_ignore_glob = ["benchmarks/**", ".github/scripts/*.py"]
def pytest_addoption(parser):
parser.addoption(
"--use-cubed", action="store_true", default=False, help="run with cubed"
)
def use_cubed():
import dask
import xarray as xr
# set xarray to use cubed by default
xr.set_options(chunk_manager="cubed")
# ensure that dask compute raises if it is ever called
class AlwaysRaiseScheduler:
def __call__(self, dsk, keys, **kwargs):
raise RuntimeError("Dask 'compute' was called")
dask.config.set(scheduler=AlwaysRaiseScheduler())
def pytest_configure(config) -> None: # type: ignore
# Add "gpu" marker
config.addinivalue_line("markers", "gpu:Run tests that run on GPU")
if config.getoption("--use-cubed"):
use_cubed()