Skip to content

Commit bf6dc99

Browse files
committed
add hypothesis test for chunk size
1 parent 49bff46 commit bf6dc99

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

@@ -758,11 +760,17 @@ def test_export_dataset_small_no_delated(
758760
assert "Writing netcdf file directly" in caplog.records[0].msg
759761

760762

763+
@settings(
764+
deadline=None,
765+
suppress_health_check=(HealthCheck.function_scoped_fixture,),
766+
)
767+
@given(max_num_files=hst.integers(min_value=1, max_value=55))
761768
def test_export_dataset_delayed_numeric(
762-
tmp_path_factory: TempPathFactory, mock_dataset_grid: DataSet, caplog
769+
max_num_files, tmp_path_factory: TempPathFactory, mock_dataset_grid: DataSet, caplog
763770
) -> None:
764-
tmp_path = tmp_path_factory.mktemp("export_netcdf")
771+
tmp_path = tmp_path_factory.mktemp(f"export_netcdf_{max_num_files}")
765772
mock_dataset_grid._export_limit = 0
773+
mock_dataset_grid._max_num_files_export = max_num_files
766774
with caplog.at_level(logging.INFO):
767775
mock_dataset_grid.export(export_type="netcdf", path=tmp_path, prefix="qcodes_")
768776

0 commit comments

Comments
 (0)