From b01100b0bf67684d6865cf5f53de3523704ebd13 Mon Sep 17 00:00:00 2001 From: Hannes Feldt <feldt@astron.nl> Date: Tue, 4 Jun 2024 16:00:31 +0200 Subject: [PATCH] fix tests --- README.md | 1 + VERSION | 2 +- lofar_station_client/statistics/reader/entry.py | 3 ++- tests/statistics/test_writer.py | 15 ++++++++------- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c886fba..110fb7a 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,7 @@ tox -e debug tests.requests.test_prometheus ## Release notes +- 0.18.9 - Fix handling of closing streams on HDF5 files - 0.18.8 - Migrate case insensitive dict from station control - 0.18.7 - Add support for various ZeroMQ package receivers - 0.18.6 - Compatability with new black versions diff --git a/VERSION b/VERSION index 0f2596a..cc7b205 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.18.8 +0.18.9 diff --git a/lofar_station_client/statistics/reader/entry.py b/lofar_station_client/statistics/reader/entry.py index 2ecc10e..f819d48 100644 --- a/lofar_station_client/statistics/reader/entry.py +++ b/lofar_station_client/statistics/reader/entry.py @@ -1,4 +1,4 @@ -# Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy) +# Copyright (C) 2024 ASTRON (Netherlands Institute for Radio Astronomy) # SPDX-License-Identifier: Apache-2.0 @@ -108,6 +108,7 @@ class StatisticsParser: logger.debug("Parsing hdf5 statistics file") with hdf5_file as statistic_data: + hdf5_file.load(statistic_data) if self.file_header is None: self.file_header = statistic_data elif not StatisticsFileHeader.__eq__(self.file_header, statistic_data): diff --git a/tests/statistics/test_writer.py b/tests/statistics/test_writer.py index eff047e..60d1d2d 100644 --- a/tests/statistics/test_writer.py +++ b/tests/statistics/test_writer.py @@ -1,16 +1,19 @@ -# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy) -# SPDX-License-Identifier: Apache-2.0 +# Copyright (C) 2024 ASTRON (Netherlands Institute for Radio Astronomy) +# SPDX-License-Identifier: Apache-2.0 +import sys from os.path import dirname, isfile from tempfile import TemporaryDirectory +from typing import Tuple from unittest import mock from unittest.mock import patch -from typing import Tuple -import sys + import h5py import numpy +from lofar_station_client import __version__ as lsc_version from lofar_station_client.dts.constants import N_pol +from lofar_station_client.statistics.reader import entry as reader_entry from lofar_station_client.statistics.statistics_data import ( StatisticsData, StatisticsFileHeader, @@ -20,8 +23,7 @@ from lofar_station_client.statistics.writer import ( hdf5, __version__ as writer_version, ) -from lofar_station_client import __version__ as lsc_version -from lofar_station_client.statistics.reader import entry as reader_entry +from tests import base from tests.test_devices import ( FakeAntennaFieldDeviceProxy, FakeOffAntennaFieldDeviceProxy, @@ -31,7 +33,6 @@ from tests.test_devices import ( FakeSDPFirmwareDeviceProxy, FakeStationManagerDeviceProxy, ) -from tests import base class TestStatisticsReaderWriter(base.TestCase): -- GitLab