Skip to content

Commit

Permalink
Fix test that loads realistic GRIB file (#2665)
Browse files Browse the repository at this point in the history
  • Loading branch information
schlunma authored Feb 17, 2025
1 parent dd1e29c commit 1690636
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 2 additions & 1 deletion doc/develop/preprocessor_function.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,13 @@ and add the following content:
"""Test function `esmvalcore.preprocessor.example_preprocessor_function`."""
from pathlib import Path
import esmvaltool_sample_data
import iris
import pytest
from esmvalcore.preprocessor import example_preprocessor_function
esmvaltool_sample_data = pytest.importorskip("esmvaltool_sample_data")
@pytest.mark.use_sample_data
def test_example_preprocessor_function():
Expand Down
13 changes: 6 additions & 7 deletions tests/integration/preprocessor/_io/test_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import tempfile
import unittest
import warnings
from importlib.resources import files as importlib_files
from pathlib import Path

import iris
import numpy as np
from iris.coords import DimCoord
from iris.cube import Cube, CubeList

import esmvalcore
from esmvalcore.preprocessor._io import load


Expand Down Expand Up @@ -56,12 +56,11 @@ def test_load(self):

def test_load_grib(self):
"""Test loading a grib file."""
grib_path = Path(
Path(esmvalcore.__file__).parents[1],
"tests",
"sample_data",
"iris-sample-data",
"polar_stereo.grib2",
grib_path = (
Path(importlib_files("tests"))
/ "sample_data"
/ "iris-sample-data"
/ "polar_stereo.grib2"
)
cubes = load(grib_path)

Expand Down

0 comments on commit 1690636

Please sign in to comment.