Skip to content

Commit

Permalink
Update conftest.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre authored Nov 7, 2024
1 parent 8dd8e87 commit dc229b0
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,30 @@ def threadsafe_data_dir(tmp_path_factory) -> Path:
yield data_dir


@pytest.fixture(autouse=True, scope="session")
def deveraux(threadsafe_data_dir, worker_id) -> pooch.Pooch:
return _deveraux(
repo=TESTDATA_REPO_URL,
branch=TESTDATA_BRANCH,
cache_dir=(
TESTDATA_CACHE_DIR if worker_id == "master" else threadsafe_data_dir
),
)


@pytest.fixture(autouse=True, scope="session")
def nimbus(threadsafe_data_dir, worker_id) -> pooch.Pooch:
kwargs = {}
if worker_id != "master":
kwargs["cache_dir"] = threadsafe_data_dir
return _nimbus(**kwargs)


@pytest.fixture
def era5_example(nimbus):
# Prepare a dataset with the required fields
file = nimbus.fetch("ERA5/daily_surface_cancities_1990-1993")
ds = xr.open_dataset(file)["huss", "pr", "snw"]
]
ds = ds.rename({"huss": "hus"})

# Fake Geopotential field
Expand Down Expand Up @@ -88,17 +100,6 @@ def era5_example(nimbus):
return ds


@pytest.fixture(autouse=True, scope="session")
def deveraux(threadsafe_data_dir, worker_id) -> pooch.Pooch:
return _deveraux(
repo=TESTDATA_REPO_URL,
branch=TESTDATA_BRANCH,
cache_dir=(
TESTDATA_CACHE_DIR if worker_id == "master" else threadsafe_data_dir
),
)


@pytest.fixture(scope="session")
def oi_data(deveraux):

Expand Down

0 comments on commit dc229b0

Please sign in to comment.