Skip to content

Commit 1faf0d5

Browse files
committed
add hypothesis test for chunk size
1 parent d41b0ea commit 1faf0d5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/dataset/test_dataset_export.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
import os
66
from pathlib import Path
77

8+
import hypothesis.strategies as hst
89
import numpy as np
910
import pytest
1011
import xarray as xr
12+
from hypothesis import HealthCheck, given, settings
1113
from numpy.testing import assert_allclose
1214
from pytest import LogCaptureFixture, TempPathFactory
1315

@@ -826,11 +828,17 @@ def test_export_dataset_small_no_delated(
826828
assert "Writing netcdf file directly" in caplog.records[0].msg
827829

828830

831+
@settings(
832+
deadline=None,
833+
suppress_health_check=(HealthCheck.function_scoped_fixture,),
834+
)
835+
@given(max_num_files=hst.integers(min_value=1, max_value=55))
829836
def test_export_dataset_delayed_numeric(
830-
tmp_path_factory: TempPathFactory, mock_dataset_grid: DataSet, caplog
837+
max_num_files, tmp_path_factory: TempPathFactory, mock_dataset_grid: DataSet, caplog
831838
) -> None:
832-
tmp_path = tmp_path_factory.mktemp("export_netcdf")
839+
tmp_path = tmp_path_factory.mktemp(f"export_netcdf_{max_num_files}")
833840
mock_dataset_grid._export_limit = 0
841+
mock_dataset_grid._max_num_files_export = max_num_files
834842
with caplog.at_level(logging.INFO):
835843
mock_dataset_grid.export(export_type="netcdf", path=tmp_path, prefix="qcodes_")
836844

0 commit comments

Comments
 (0)