Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
uriii3 committed Feb 4, 2025
1 parent 327c373 commit 14ecbda
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions tests/test_command_line_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,19 @@ def test_retention_period_works(self, tmp_path):
"48.13780081656672",
"--output-directory",
tmp_path,
"--output-filename",
"dataset.nc",
"--log-level",
"DEBUG",
]

self.output = execute_in_terminal(self.command)
assert self.output.returncode == 0
assert (
b"time (time) datetime64[ns] 2023" not in self.output.stderr
)
response = loads(self.output.stdout)
main_checks_when_file_is_downloaded(tmp_path / "dataset.nc", response)

def test_retention_period_works_when_only_values_in_metadata(
self, tmp_path
Expand Down Expand Up @@ -660,7 +665,7 @@ def then_I_got_a_clear_output_with_available_service_for_subset(self):

def when_I_request_subset_dataset_with_zarr_service(
self,
output_path,
tmp_path,
vertical_axis: Literal["depth", "elevation"] = "depth",
):
command = [
Expand Down Expand Up @@ -691,12 +696,14 @@ def when_I_request_subset_dataset_with_zarr_service(
"--service",
"arco-time-series",
"-o",
f"{output_path}",
f"{tmp_path}",
"-f",
"data.zarr",
]

self.output = execute_in_terminal(command)
response = loads(self.output.stdout)
main_checks_when_file_is_downloaded(tmp_path / "data.zarr", response)

def then_I_have_correct_sign_for_depth_coordinates_values(
self, output_path, sign
Expand Down Expand Up @@ -862,11 +869,15 @@ def test_subset_with_chunking(
"8",
"-o",
f"{tmp_path}",
"f",
"output.nc",
]

self.output = execute_in_terminal(command)

assert self.output.returncode == 0
response = loads(self.output.stdout)
main_checks_when_file_is_downloaded(tmp_path / "output.nc", response)

def test_short_option_for_copernicus_marine_command_helper(self):
short_option_command = [
Expand Down Expand Up @@ -1047,6 +1058,10 @@ def test_subset_filter_by_standard_name(self, tmp_path):
"thetao"
in xarray.open_zarr(f"{tmp_path}/{output_filename}").variables
)
response = loads(self.output.stdout)
main_checks_when_file_is_downloaded(
tmp_path / output_filename, response
)

def test_log_level_debug(self, tmp_path):
dataset_id = "cmems_mod_ibi_phy_my_0.083deg-3D_P1Y-m"
Expand Down Expand Up @@ -1084,6 +1099,10 @@ def test_log_level_debug(self, tmp_path):
self.output = execute_in_terminal(command)
assert self.output.returncode == 0
assert b"DEBUG - " in self.output.stderr
response = loads(self.output.stdout)
main_checks_when_file_is_downloaded(
tmp_path / output_filename, response
)

def test_arco_subset_is_fast(self, tmp_path):
command = [
Expand Down Expand Up @@ -1220,6 +1239,10 @@ def test_dataset_has_always_every_dimensions(self, tmp_path):
)
== 4
)
response = loads(self.output.stdout)
main_checks_when_file_is_downloaded(
tmp_path / output_filename, response
)

def test_netcdf_compression_option(self, tmp_path):
filename_without_option = "without_option.nc"
Expand Down

0 comments on commit 14ecbda

Please sign in to comment.