From a73f246c82f7efaa4955edbc87a9d79a0dac6f30 Mon Sep 17 00:00:00 2001 From: ahobeost Date: Tue, 5 Aug 2025 11:41:34 +0200 Subject: [PATCH 01/14] Check both types of step files with "_step.prt". --- pytrnsys_process/process/process_sim.py | 13 ++++++++++--- .../process-sim/sim-2/temp/HPCtrlPrinter_step.Prt | 6 ++++++ tests/pytrnsys_process/test_process_sim.py | 14 +++++++++++++- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 tests/pytrnsys_process/data/process-sim/sim-2/temp/HPCtrlPrinter_step.Prt diff --git a/pytrnsys_process/process/process_sim.py b/pytrnsys_process/process/process_sim.py index 2842e8f..fc67849 100644 --- a/pytrnsys_process/process/process_sim.py +++ b/pytrnsys_process/process/process_sim.py @@ -186,9 +186,16 @@ def _process_file( file_type == conf.FileType.TIMESTEP and conf.global_settings.reader.read_step_files ): - simulation_data_collector.step.append( - _read_file(file_path, conf.FileType.TIMESTEP) - ) + # There are two ways to have a step file: + # - using type 25 + # - using type 46 + # The user can copy and paste both, and they would like to use '_step.prt'. + # Here we try both, as a temporary solution, till the file reading is fully refactored. + try: + step_df = _read_file(file_path, conf.FileType.TIMESTEP) + except KeyError: + step_df = _read_file(file_path, conf.FileType.HYDRAULIC) + simulation_data_collector.step.append(step_df) elif ( file_type == conf.FileType.HYDRAULIC and conf.global_settings.reader.read_step_files diff --git a/tests/pytrnsys_process/data/process-sim/sim-2/temp/HPCtrlPrinter_step.Prt b/tests/pytrnsys_process/data/process-sim/sim-2/temp/HPCtrlPrinter_step.Prt new file mode 100644 index 0000000..97d9920 --- /dev/null +++ b/tests/pytrnsys_process/data/process-sim/sim-2/temp/HPCtrlPrinter_step.Prt @@ -0,0 +1,6 @@ + TIME HPCtrl PriceCtrl ElPrice HotWatCtrl HotWatProportion + +0.0000000000000000E+00 +0.0000000000000000E+00 +1.0000000000000000E+00 +2.0997000000000000E+01 +2.0000000000000000E+00 +9.9999837206454878E-01 + +1.6666666666666666E-01 +1.0000000000000000E+00 +1.0000000000000000E+00 +1.5273000000000000E+01 +2.0000000000000000E+00 +9.9999837206454878E-01 + +3.3333333333333331E-01 +1.0000000000000000E+00 +1.0000000000000000E+00 +1.5273000000000000E+01 +2.0000000000000000E+00 +9.9999837206454878E-01 + +5.0000000000000000E-01 +1.0000000000000000E+00 +1.0000000000000000E+00 +1.5273000000000000E+01 +2.0000000000000000E+00 +9.9999837206454878E-01 + +6.6666666666666663E-01 +1.0000000000000000E+00 +1.0000000000000000E+00 +1.5273000000000000E+01 +2.0000000000000000E+00 +9.9999837206454878E-01 diff --git a/tests/pytrnsys_process/test_process_sim.py b/tests/pytrnsys_process/test_process_sim.py index fa333b4..452219b 100644 --- a/tests/pytrnsys_process/test_process_sim.py +++ b/tests/pytrnsys_process/test_process_sim.py @@ -6,6 +6,7 @@ from pytrnsys_process.process import process_sim as ps PATH_TO_RESULTS = const.DATA_FOLDER / "process-sim/sim-1" +PATH_TO_RESULTS_2 = const.DATA_FOLDER / "process-sim/sim-2" class TestProcessSim: @@ -57,7 +58,18 @@ def test_process_sim_ignore_deck(self, monkeypatch): simulation = ps.process_sim(sim_files, PATH_TO_RESULTS) assert simulation.scalar.shape == (0, 0) - def do_assert(self, simulation): + def test_process_sim_type_25_step(self, monkeypatch): + monkeypatch.setattr( + "pytrnsys_process.config.global_settings.reader.read_step_files", + True, + ) + sim_files = util.get_files([PATH_TO_RESULTS_2], get_mfr_and_t=False, read_deck_files=False) + simulation = ps.process_sim(sim_files, PATH_TO_RESULTS_2) + + assert simulation.step.shape == (5, 5) + + @staticmethod + def do_assert(simulation): assert simulation.hourly.shape == (3, 18) assert simulation.monthly.shape == (14, 11) assert simulation.step.shape == (5, 142) From 7a907737b6277a684ea83d98c7b55e04be9c267c Mon Sep 17 00:00:00 2001 From: ahobeost Date: Tue, 5 Aug 2025 11:48:06 +0200 Subject: [PATCH 02/14] Refactored test as it was not producing any feedback. --- tests/pytrnsys_process/test_process_sim.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/pytrnsys_process/test_process_sim.py b/tests/pytrnsys_process/test_process_sim.py index 452219b..8b74840 100644 --- a/tests/pytrnsys_process/test_process_sim.py +++ b/tests/pytrnsys_process/test_process_sim.py @@ -19,11 +19,10 @@ def test_process_sim_prt(self, monkeypatch): sim_files = util.get_files([PATH_TO_RESULTS], get_mfr_and_t=True) simulation = ps.process_sim(sim_files, PATH_TO_RESULTS) - with _pt.raises(Exception) as exc_info: - assert ( - "don-not-process.xlsx: No columns to parse from file" - in str(exc_info.value) - ) + with open(PATH_TO_RESULTS / "processing.log") as f: + logging_text = f.read() + + assert "don-not-process.xlsx: No columns to parse from file" not in logging_text self.do_assert(simulation) assert simulation.scalar.shape == (1, 10) @@ -117,8 +116,8 @@ def test_handle_with_conflicting_duplicates(self): df3 = _pd.DataFrame({"A": [3, 2], "D": [7, 8]}) with _pt.raises( - ValueError, - match="Column 'A' has conflicting values at same indices", + ValueError, + match="Column 'A' has conflicting values at same indices", ): ps.handle_duplicate_columns(_pd.concat([df1, df2, df3], axis=1)) @@ -156,8 +155,8 @@ def test_handle_with_conflicting_none_duplicates(self): df3 = _pd.DataFrame({"A": [None, 2], "C": [5, 6]}) with _pt.raises( - ValueError, - match="Column 'A' has NaN values in one column while having actual values in another", + ValueError, + match="Column 'A' has NaN values in one column while having actual values in another", ): ps.handle_duplicate_columns(_pd.concat([df1, df2, df3], axis=1)) From dcb4b42124e008c1d86af10377ad27eaf347d104 Mon Sep 17 00:00:00 2001 From: ahobeost Date: Tue, 5 Aug 2025 11:49:03 +0200 Subject: [PATCH 03/14] Updated version to 0.0.28 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index fee7f94..13a3cbb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pytrnsys_process" -version = "0.0.27" +version = "0.0.28" authors = [ { name="Alex Hobé", email="alex.hobe@ost.ch" }, { name="Sebastian Swoboda", email="sebastian@swoboda.ch" }, From e97b13e0331ce671ff1bc225a5197c12d672a9a7 Mon Sep 17 00:00:00 2001 From: ahobeost Date: Tue, 5 Aug 2025 11:53:53 +0200 Subject: [PATCH 04/14] CI changes --- tests/pytrnsys_process/test_process_sim.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/pytrnsys_process/test_process_sim.py b/tests/pytrnsys_process/test_process_sim.py index 8b74840..cbc27db 100644 --- a/tests/pytrnsys_process/test_process_sim.py +++ b/tests/pytrnsys_process/test_process_sim.py @@ -19,10 +19,13 @@ def test_process_sim_prt(self, monkeypatch): sim_files = util.get_files([PATH_TO_RESULTS], get_mfr_and_t=True) simulation = ps.process_sim(sim_files, PATH_TO_RESULTS) - with open(PATH_TO_RESULTS / "processing.log") as f: + with open(PATH_TO_RESULTS / "processing.log", encoding="utf-8") as f: logging_text = f.read() - assert "don-not-process.xlsx: No columns to parse from file" not in logging_text + assert ( + "don-not-process.xlsx: No columns to parse from file" + in logging_text + ) self.do_assert(simulation) assert simulation.scalar.shape == (1, 10) @@ -62,7 +65,9 @@ def test_process_sim_type_25_step(self, monkeypatch): "pytrnsys_process.config.global_settings.reader.read_step_files", True, ) - sim_files = util.get_files([PATH_TO_RESULTS_2], get_mfr_and_t=False, read_deck_files=False) + sim_files = util.get_files( + [PATH_TO_RESULTS_2], get_mfr_and_t=False, read_deck_files=False + ) simulation = ps.process_sim(sim_files, PATH_TO_RESULTS_2) assert simulation.step.shape == (5, 5) @@ -116,8 +121,8 @@ def test_handle_with_conflicting_duplicates(self): df3 = _pd.DataFrame({"A": [3, 2], "D": [7, 8]}) with _pt.raises( - ValueError, - match="Column 'A' has conflicting values at same indices", + ValueError, + match="Column 'A' has conflicting values at same indices", ): ps.handle_duplicate_columns(_pd.concat([df1, df2, df3], axis=1)) @@ -155,8 +160,8 @@ def test_handle_with_conflicting_none_duplicates(self): df3 = _pd.DataFrame({"A": [None, 2], "C": [5, 6]}) with _pt.raises( - ValueError, - match="Column 'A' has NaN values in one column while having actual values in another", + ValueError, + match="Column 'A' has NaN values in one column while having actual values in another", ): ps.handle_duplicate_columns(_pd.concat([df1, df2, df3], axis=1)) From 711ca4ffd57e730861e99551fc00826f3cd09219 Mon Sep 17 00:00:00 2001 From: ahobeost Date: Tue, 5 Aug 2025 12:52:29 +0200 Subject: [PATCH 05/14] Slight refactoring to fix file not found error on linux --- tests/pytrnsys_process/test_process_sim.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/pytrnsys_process/test_process_sim.py b/tests/pytrnsys_process/test_process_sim.py index cbc27db..9278148 100644 --- a/tests/pytrnsys_process/test_process_sim.py +++ b/tests/pytrnsys_process/test_process_sim.py @@ -5,8 +5,8 @@ from pytrnsys_process import util from pytrnsys_process.process import process_sim as ps -PATH_TO_RESULTS = const.DATA_FOLDER / "process-sim/sim-1" -PATH_TO_RESULTS_2 = const.DATA_FOLDER / "process-sim/sim-2" +PATH_TO_RESULTS = const.DATA_FOLDER / "process-sim" / "sim-1" +PATH_TO_RESULTS_2 = const.DATA_FOLDER / "process-sim" / "sim-2" class TestProcessSim: From dde2869fcf7df4ce283e25a06d213116e717e204 Mon Sep 17 00:00:00 2001 From: ahobeost Date: Tue, 5 Aug 2025 12:58:25 +0200 Subject: [PATCH 06/14] Debugging statements for paths. --- tests/pytrnsys_process/test_process_sim.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/pytrnsys_process/test_process_sim.py b/tests/pytrnsys_process/test_process_sim.py index 9278148..340238d 100644 --- a/tests/pytrnsys_process/test_process_sim.py +++ b/tests/pytrnsys_process/test_process_sim.py @@ -12,6 +12,9 @@ class TestProcessSim: def test_process_sim_prt(self, monkeypatch): + if not PATH_TO_RESULTS.exists(): + raise FileNotFoundError("Files themselves not found.") + monkeypatch.setattr( "pytrnsys_process.config.global_settings.reader.read_step_files", True, @@ -19,7 +22,11 @@ def test_process_sim_prt(self, monkeypatch): sim_files = util.get_files([PATH_TO_RESULTS], get_mfr_and_t=True) simulation = ps.process_sim(sim_files, PATH_TO_RESULTS) - with open(PATH_TO_RESULTS / "processing.log", encoding="utf-8") as f: + log_file_path = PATH_TO_RESULTS / "processing.log" + if not log_file_path.exists(): + raise FileNotFoundError("Log file not found.") + + with open(log_file_path, encoding="utf-8") as f: logging_text = f.read() assert ( From 5e95d73b877e1dc6f5c34d64597b6e8f4114684c Mon Sep 17 00:00:00 2001 From: ahobeost Date: Tue, 5 Aug 2025 13:02:04 +0200 Subject: [PATCH 07/14] Temporary change to reduce CI to one test. --- dev-tools/dev_tools.py | 1 + tests/pytrnsys_process/test_process_sim.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dev-tools/dev_tools.py b/dev-tools/dev_tools.py index 76d3eaa..e77909b 100644 --- a/dev-tools/dev_tools.py +++ b/dev-tools/dev_tools.py @@ -241,6 +241,7 @@ def _run_unit_tests_with_pytest(arguments, test_results_dir_path): _SCRIPTS_DIR / "pytest", "-v", "-n 2", + "-k TestProcessSim", "--dist=loadfile", "--benchmark-skip", "--cov=pytrnsys_process", diff --git a/tests/pytrnsys_process/test_process_sim.py b/tests/pytrnsys_process/test_process_sim.py index 340238d..bc61f73 100644 --- a/tests/pytrnsys_process/test_process_sim.py +++ b/tests/pytrnsys_process/test_process_sim.py @@ -25,7 +25,7 @@ def test_process_sim_prt(self, monkeypatch): log_file_path = PATH_TO_RESULTS / "processing.log" if not log_file_path.exists(): raise FileNotFoundError("Log file not found.") - + with open(log_file_path, encoding="utf-8") as f: logging_text = f.read() From 6a1d38629e47c8d9efe7710cd284718b9c274041 Mon Sep 17 00:00:00 2001 From: ahobeost Date: Tue, 5 Aug 2025 13:03:16 +0200 Subject: [PATCH 08/14] Reduce linux job to just test. --- .github/workflows/tests-and-checks-linux.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests-and-checks-linux.yml b/.github/workflows/tests-and-checks-linux.yml index d46fd4b..e149bce 100644 --- a/.github/workflows/tests-and-checks-linux.yml +++ b/.github/workflows/tests-and-checks-linux.yml @@ -25,15 +25,15 @@ jobs: python -m pip install --upgrade pip python -m pip install wheel pip install -r requirements/test.txt - - name: Syntax checking with black - run: python dev-tools/dev_tools.py --black --keep-results - - name: Static type checking with mypy - run: python dev-tools/dev_tools.py --type - - name: Lint with pylint - run: python dev-tools/dev_tools.py --lint --keep-results - - name: Generate class and package diagrams - run: | - python dev-tools/dev_tools.py --diagram --keep-results +# - name: Syntax checking with black +# run: python dev-tools/dev_tools.py --black --keep-results +# - name: Static type checking with mypy +# run: python dev-tools/dev_tools.py --type +# - name: Lint with pylint +# run: python dev-tools/dev_tools.py --lint --keep-results +# - name: Generate class and package diagrams +# run: | +# python dev-tools/dev_tools.py --diagram --keep-results - name: Test with pytest run: python dev-tools/dev_tools.py --unit "not manual and not windows and not tool" --keep-results - name: Build documentation From 3d2526d9daa82f5500884f8975a32326c1127fe3 Mon Sep 17 00:00:00 2001 From: ahobeost Date: Tue, 5 Aug 2025 13:09:13 +0200 Subject: [PATCH 09/14] Checking whether there are dependencies between tests. --- dev-tools/dev_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-tools/dev_tools.py b/dev-tools/dev_tools.py index e77909b..f479aef 100644 --- a/dev-tools/dev_tools.py +++ b/dev-tools/dev_tools.py @@ -241,7 +241,7 @@ def _run_unit_tests_with_pytest(arguments, test_results_dir_path): _SCRIPTS_DIR / "pytest", "-v", "-n 2", - "-k TestProcessSim", + # "-k TestProcessSim", "--dist=loadfile", "--benchmark-skip", "--cov=pytrnsys_process", From 784dba12a97badc99545d1c61f045da7dae2bf5f Mon Sep 17 00:00:00 2001 From: ahobeost Date: Tue, 5 Aug 2025 13:27:33 +0200 Subject: [PATCH 10/14] Use caplog instead of reading file. --- dev-tools/dev_tools.py | 1 - tests/pytrnsys_process/test_process_sim.py | 20 ++++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/dev-tools/dev_tools.py b/dev-tools/dev_tools.py index f479aef..76d3eaa 100644 --- a/dev-tools/dev_tools.py +++ b/dev-tools/dev_tools.py @@ -241,7 +241,6 @@ def _run_unit_tests_with_pytest(arguments, test_results_dir_path): _SCRIPTS_DIR / "pytest", "-v", "-n 2", - # "-k TestProcessSim", "--dist=loadfile", "--benchmark-skip", "--cov=pytrnsys_process", diff --git a/tests/pytrnsys_process/test_process_sim.py b/tests/pytrnsys_process/test_process_sim.py index bc61f73..9c87ae3 100644 --- a/tests/pytrnsys_process/test_process_sim.py +++ b/tests/pytrnsys_process/test_process_sim.py @@ -1,5 +1,6 @@ import pandas as _pd import pytest as _pt +import logging as _logging import tests.pytrnsys_process.constants as const from pytrnsys_process import util @@ -11,27 +12,22 @@ class TestProcessSim: - def test_process_sim_prt(self, monkeypatch): - if not PATH_TO_RESULTS.exists(): - raise FileNotFoundError("Files themselves not found.") - + def test_process_sim_prt(self, monkeypatch, caplog): monkeypatch.setattr( "pytrnsys_process.config.global_settings.reader.read_step_files", True, ) sim_files = util.get_files([PATH_TO_RESULTS], get_mfr_and_t=True) - simulation = ps.process_sim(sim_files, PATH_TO_RESULTS) - - log_file_path = PATH_TO_RESULTS / "processing.log" - if not log_file_path.exists(): - raise FileNotFoundError("Log file not found.") - with open(log_file_path, encoding="utf-8") as f: - logging_text = f.read() + def run_with_caplog(files): + caplog.clear() + with caplog.at_level(_logging.INFO): + return ps.process_sim(files, PATH_TO_RESULTS) + simulation = run_with_caplog(sim_files) assert ( "don-not-process.xlsx: No columns to parse from file" - in logging_text + in caplog.text ) self.do_assert(simulation) assert simulation.scalar.shape == (1, 10) From 08c61a52455ca02619e30fb67d7398650ebccbf7 Mon Sep 17 00:00:00 2001 From: ahobeost Date: Tue, 5 Aug 2025 13:35:18 +0200 Subject: [PATCH 11/14] CI changes --- tests/pytrnsys_process/test_process_sim.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/pytrnsys_process/test_process_sim.py b/tests/pytrnsys_process/test_process_sim.py index 9c87ae3..fe5f044 100644 --- a/tests/pytrnsys_process/test_process_sim.py +++ b/tests/pytrnsys_process/test_process_sim.py @@ -1,6 +1,7 @@ +import logging as _logging + import pandas as _pd import pytest as _pt -import logging as _logging import tests.pytrnsys_process.constants as const from pytrnsys_process import util @@ -13,6 +14,8 @@ class TestProcessSim: def test_process_sim_prt(self, monkeypatch, caplog): + # The following monkeypatch is needed, as otherwise these tests do not + # incorporate the changed setting properly. monkeypatch.setattr( "pytrnsys_process.config.global_settings.reader.read_step_files", True, @@ -23,6 +26,7 @@ def run_with_caplog(files): caplog.clear() with caplog.at_level(_logging.INFO): return ps.process_sim(files, PATH_TO_RESULTS) + simulation = run_with_caplog(sim_files) assert ( From 178222e171bd6027d42cce02406f15c3192a7a93 Mon Sep 17 00:00:00 2001 From: ahobeost Date: Tue, 5 Aug 2025 13:54:48 +0200 Subject: [PATCH 12/14] Ensured newly uncovered code is covered again and some refactoring. --- .../ENERGY_BALANCE_MO_HP_60_incorrect.Prt | 40 +++++++++++++++++++ tests/pytrnsys_process/test_process_sim.py | 17 ++++---- 2 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 tests/pytrnsys_process/data/process-sim/sim-2/temp/ENERGY_BALANCE_MO_HP_60_incorrect.Prt diff --git a/tests/pytrnsys_process/data/process-sim/sim-2/temp/ENERGY_BALANCE_MO_HP_60_incorrect.Prt b/tests/pytrnsys_process/data/process-sim/sim-2/temp/ENERGY_BALANCE_MO_HP_60_incorrect.Prt new file mode 100644 index 0000000..a6195af --- /dev/null +++ b/tests/pytrnsys_process/data/process-sim/sim-2/temp/ENERGY_BALANCE_MO_HP_60_incorrect.Prt @@ -0,0 +1,40 @@ + Label not available Label not available Label not available Label not available +Period TIME QSnk60PauxEvap_kW QSnk60PelAuxComp_kW QSnk60PauxCondSwitch_kW +November +0.8016000000000000E+004 +0.2161358340750096E+005 +0.5776788628296898E+004 +0.2739037203579770E+005 +December +0.8760000000000000E+004 +0.2838888210807185E+005 +0.8140286109162899E+004 +0.3652916821723460E+005 +January +0.9504000000000000E+004 +0.3099081794071290E+005 +0.9306178154672469E+004 +0.4029699609538541E+005 +February +0.1017600000000000E+005 +0.2580109312781669E+005 +0.7868013262659784E+004 +0.3366910639047660E+005 +March +0.1092000000000000E+005 +0.2120961830858527E+005 +0.6169001827384862E+004 +0.2737862013597025E+005 +April +0.1164000000000000E+005 +0.1486670395882630E+005 +0.3978451920217696E+004 +0.1884515587904413E+005 +May +0.1238400000000000E+005 +0.7628377358636680E+004 +0.1915581261331994E+004 +0.9543958619968678E+004 +June +0.1310400000000000E+005 +0.2731920242477886E+004 +0.6593262316230313E+003 +0.3391246474100910E+004 +July +0.1384800000000000E+005 +0.1063312304434059E+004 +0.2777601024093779E+003 +0.1341072406843437E+004 +August +0.1459200000000000E+005 +0.2057131024277858E+004 +0.4836754477946225E+003 +0.2540806472072484E+004 +September +0.1531200000000000E+005 +0.4886254979749180E+004 +0.1108116448792786E+004 +0.5994371428541986E+004 +October +0.1605600000000000E+005 +0.1312982789194613E+005 +0.3133620291843777E+004 +0.1626344818378989E+005 +November +0.1677600000000000E+005 +0.2141597363167885E+005 +0.5715598281347823E+004 +0.2713157191302666E+005 +December +0.1752000000000000E+005 +0.2837193267579600E+005 +0.8142118404336021E+004 +0.3651405108013218E+005 + + Maximum Instantaneous Values + Label not available Label not available Label not available Label not available +Maximum Value +0.1752000000000000E+005 +0.1301301130104686E+003 +0.3577578501555571E+002 +0.1567056145561912E+003 +Time of Maximum +0.1752000000000000E+005 +0.1453096666666667E+005 +0.1429330000000000E+005 +0.1453096666666667E+005 + + Minimum Instantaneous Values + Label not available Label not available Label not available Label not available +Minimum Value +0.7300033333333334E+004 +0.0000000000000000E+000 +0.0000000000000000E+000 +0.0000000000000000E+000 +Time of Minimum +0.7300033333333334E+004 +0.1752000000000000E+005 +0.1752000000000000E+005 +0.1752000000000000E+005 + + Maximum Integrated Values + Label not available Label not available Label not available Label not available +Maximum Value +0.1752000000000000E+005 +0.3099081794071290E+005 +0.9306178154672469E+004 +0.4029699609538541E+005 +Time of Maximum +0.1752000000000000E+005 +0.9504000000000000E+004 +0.9504000000000000E+004 +0.9504000000000000E+004 + + Minimum Integrated Values + Label not available Label not available Label not available Label not available +Minimum Value +0.8016000000000000E+004 +0.1063312304434059E+004 +0.2777601024093779E+003 +0.1341072406843437E+004 +Time of Minimum +0.8016000000000000E+004 +0.1384800000000000E+005 +0.1384800000000000E+005 +0.1384800000000000E+005 + + Sum (note: sums are set to zero for inputs that were not integrated.) + Label not available Label not available Label not available Label not available +Total +0.0000000000000000E+000 +0.2241554289605119E+006 +0.6267451637187461E+005 +0.2868299453323836E+006 diff --git a/tests/pytrnsys_process/test_process_sim.py b/tests/pytrnsys_process/test_process_sim.py index fe5f044..3621027 100644 --- a/tests/pytrnsys_process/test_process_sim.py +++ b/tests/pytrnsys_process/test_process_sim.py @@ -12,6 +12,11 @@ class TestProcessSim: + @staticmethod + def run_process_sim_with_caplog(files, results_path, caplog): + caplog.clear() + with caplog.at_level(_logging.INFO): + return ps.process_sim(files, results_path) def test_process_sim_prt(self, monkeypatch, caplog): # The following monkeypatch is needed, as otherwise these tests do not @@ -22,12 +27,7 @@ def test_process_sim_prt(self, monkeypatch, caplog): ) sim_files = util.get_files([PATH_TO_RESULTS], get_mfr_and_t=True) - def run_with_caplog(files): - caplog.clear() - with caplog.at_level(_logging.INFO): - return ps.process_sim(files, PATH_TO_RESULTS) - - simulation = run_with_caplog(sim_files) + simulation = self.run_process_sim_with_caplog(sim_files, PATH_TO_RESULTS, caplog) assert ( "don-not-process.xlsx: No columns to parse from file" @@ -67,7 +67,7 @@ def test_process_sim_ignore_deck(self, monkeypatch): simulation = ps.process_sim(sim_files, PATH_TO_RESULTS) assert simulation.scalar.shape == (0, 0) - def test_process_sim_type_25_step(self, monkeypatch): + def test_process_sim_type_25_step(self, monkeypatch, caplog): monkeypatch.setattr( "pytrnsys_process.config.global_settings.reader.read_step_files", True, @@ -75,7 +75,8 @@ def test_process_sim_type_25_step(self, monkeypatch): sim_files = util.get_files( [PATH_TO_RESULTS_2], get_mfr_and_t=False, read_deck_files=False ) - simulation = ps.process_sim(sim_files, PATH_TO_RESULTS_2) + simulation = self.run_process_sim_with_caplog(sim_files, PATH_TO_RESULTS_2, caplog) + assert "KeyError: 'Month'" in caplog.text assert simulation.step.shape == (5, 5) From e6393f83d388fcd216fc29b395a857f085f5d074 Mon Sep 17 00:00:00 2001 From: ahobeost Date: Tue, 5 Aug 2025 13:55:12 +0200 Subject: [PATCH 13/14] Fixed deprecation warning. --- pytrnsys_process/plot/plotters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytrnsys_process/plot/plotters.py b/pytrnsys_process/plot/plotters.py index 0f666a2..87b3fee 100644 --- a/pytrnsys_process/plot/plotters.py +++ b/pytrnsys_process/plot/plotters.py @@ -124,7 +124,7 @@ def _do_plot( cmap = self.get_cmap(kwargs) if cmap: - cm = _plt.cm.get_cmap(cmap) + cm = _plt.get_cmap(cmap) colors = cm(_np.linspace(0, 1, len(columns))) else: colors = [None] * len(columns) From c3578352fac2da7b26bc2cd6a440f05e972b09c8 Mon Sep 17 00:00:00 2001 From: ahobeost Date: Tue, 5 Aug 2025 13:56:41 +0200 Subject: [PATCH 14/14] CI cleanup --- .github/workflows/tests-and-checks-linux.yml | 18 +++++++++--------- tests/pytrnsys_process/test_process_sim.py | 8 ++++++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests-and-checks-linux.yml b/.github/workflows/tests-and-checks-linux.yml index e149bce..d46fd4b 100644 --- a/.github/workflows/tests-and-checks-linux.yml +++ b/.github/workflows/tests-and-checks-linux.yml @@ -25,15 +25,15 @@ jobs: python -m pip install --upgrade pip python -m pip install wheel pip install -r requirements/test.txt -# - name: Syntax checking with black -# run: python dev-tools/dev_tools.py --black --keep-results -# - name: Static type checking with mypy -# run: python dev-tools/dev_tools.py --type -# - name: Lint with pylint -# run: python dev-tools/dev_tools.py --lint --keep-results -# - name: Generate class and package diagrams -# run: | -# python dev-tools/dev_tools.py --diagram --keep-results + - name: Syntax checking with black + run: python dev-tools/dev_tools.py --black --keep-results + - name: Static type checking with mypy + run: python dev-tools/dev_tools.py --type + - name: Lint with pylint + run: python dev-tools/dev_tools.py --lint --keep-results + - name: Generate class and package diagrams + run: | + python dev-tools/dev_tools.py --diagram --keep-results - name: Test with pytest run: python dev-tools/dev_tools.py --unit "not manual and not windows and not tool" --keep-results - name: Build documentation diff --git a/tests/pytrnsys_process/test_process_sim.py b/tests/pytrnsys_process/test_process_sim.py index 3621027..f79fee5 100644 --- a/tests/pytrnsys_process/test_process_sim.py +++ b/tests/pytrnsys_process/test_process_sim.py @@ -27,7 +27,9 @@ def test_process_sim_prt(self, monkeypatch, caplog): ) sim_files = util.get_files([PATH_TO_RESULTS], get_mfr_and_t=True) - simulation = self.run_process_sim_with_caplog(sim_files, PATH_TO_RESULTS, caplog) + simulation = self.run_process_sim_with_caplog( + sim_files, PATH_TO_RESULTS, caplog + ) assert ( "don-not-process.xlsx: No columns to parse from file" @@ -75,7 +77,9 @@ def test_process_sim_type_25_step(self, monkeypatch, caplog): sim_files = util.get_files( [PATH_TO_RESULTS_2], get_mfr_and_t=False, read_deck_files=False ) - simulation = self.run_process_sim_with_caplog(sim_files, PATH_TO_RESULTS_2, caplog) + simulation = self.run_process_sim_with_caplog( + sim_files, PATH_TO_RESULTS_2, caplog + ) assert "KeyError: 'Month'" in caplog.text assert simulation.step.shape == (5, 5)