From 1faf0d50559cc2df4d931ea8220da0ede75e364c Mon Sep 17 00:00:00 2001 From: "Jens H. Nielsen" Date: Thu, 16 Nov 2023 07:04:41 +0100 Subject: [PATCH] add hypothesis test for chunk size --- tests/dataset/test_dataset_export.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/dataset/test_dataset_export.py b/tests/dataset/test_dataset_export.py index f9f00195aff..d38c7cd86ad 100644 --- a/tests/dataset/test_dataset_export.py +++ b/tests/dataset/test_dataset_export.py @@ -5,9 +5,11 @@ import os from pathlib import Path +import hypothesis.strategies as hst import numpy as np import pytest import xarray as xr +from hypothesis import HealthCheck, given, settings from numpy.testing import assert_allclose from pytest import LogCaptureFixture, TempPathFactory @@ -826,11 +828,17 @@ def test_export_dataset_small_no_delated( assert "Writing netcdf file directly" in caplog.records[0].msg +@settings( + deadline=None, + suppress_health_check=(HealthCheck.function_scoped_fixture,), +) +@given(max_num_files=hst.integers(min_value=1, max_value=55)) def test_export_dataset_delayed_numeric( - tmp_path_factory: TempPathFactory, mock_dataset_grid: DataSet, caplog + max_num_files, tmp_path_factory: TempPathFactory, mock_dataset_grid: DataSet, caplog ) -> None: - tmp_path = tmp_path_factory.mktemp("export_netcdf") + tmp_path = tmp_path_factory.mktemp(f"export_netcdf_{max_num_files}") mock_dataset_grid._export_limit = 0 + mock_dataset_grid._max_num_files_export = max_num_files with caplog.at_level(logging.INFO): mock_dataset_grid.export(export_type="netcdf", path=tmp_path, prefix="qcodes_")