Skip to content

Commit

Permalink
add hypothesis test for chunk size
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshnielsen committed Dec 12, 2023
1 parent 49bff46 commit bf6dc99
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/dataset/test_dataset_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -758,11 +760,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_")

Expand Down

0 comments on commit bf6dc99

Please sign in to comment.