Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#461 implement json compare in tests #465

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 2 additions & 34 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import os
import shutil
import json
import xarray as xr
from pandas import DatetimeIndex


# This fixture temporarily sets the working directory
# to the dir containing the test file. This means
Expand Down Expand Up @@ -76,35 +75,4 @@ def remove_the_files(test_dir, file_list):
except FileNotFoundError:
pass

return remove_the_files


TEST_NC_DATA = xr.Dataset(
{
"precip": xr.DataArray(
[
[[0.1, 0.2, 0.3], [0, 1.3, 4], [0, 20, 0]],
[[0, 0, 0], [0, 0, 0], [0, 0, 0]],
],
coords={
"lat": [-1, 0, 1],
"lon": [112, 113, 114],
"time": DatetimeIndex(["2024-09-25 00:00:00", "2024-09-25 03:00:33"]),
},
dims=["time", "lat", "lon"],
attrs={"long_name": "variable long name"},
),
},
attrs={"Conventions": "CF-99.9", "history": "History string"},
)

@pytest.fixture()
def nc_test_file(tmp_path_factory):
"""Create a netCDF file with a very small amount of data.
File is written to a temp directory and the path to the
file returned as the fixture value.
"""
file_name = tmp_path_factory.mktemp("data") / "test_data.nc"
TEST_NC_DATA.to_netcdf(file_name)
return file_name

return remove_the_files
5 changes: 0 additions & 5 deletions test/scatter/test_scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,3 @@ def test_scatter(assert_json_equal):
scat = scatter.Scatter(util.get_params("custom_scatter.yaml"))
assert_json_equal(scat.figure, "custom_scatter_expected.json")


def test_main():
# check that main can execute without error.
scatter.main()

Loading