From 19bbdb03e85262d40fbc1da81432c1228467d06e Mon Sep 17 00:00:00 2001 From: Sven Sager Date: Tue, 12 Nov 2024 10:18:52 +0100 Subject: [PATCH 1/3] test: Fix test for default location of config.rsc The tests for the default path of the config.rsc are now performed optionally. If write permission exists for the standard paths, the tests are performed with the config.rsc. --- tests/common/test_init_modio.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/common/test_init_modio.py b/tests/common/test_init_modio.py index aac5725..0dffa5d 100644 --- a/tests/common/test_init_modio.py +++ b/tests/common/test_init_modio.py @@ -4,9 +4,10 @@ __author__ = "Sven Sager" __copyright__ = "Copyright (C) 2024 Sven Sager" __license__ = "GPLv2" -from os import remove +from os import remove, makedirs from os.path import join, dirname from shutil import copyfile +from warnings import warn import revpimodio2 from .. import TestRevPiModIO @@ -30,11 +31,17 @@ class TestInitModio(TestRevPiModIO): "configrsc": join(self.data_dir, "config.rsc"), } - # Datei an richtigen Ort kopieren und löschen - copyfile(defaultkwargs["configrsc"], "/opt/KUNBUS/config.rsc") - rpi = revpimodio2.RevPiModIO(procimg=self.fh_procimg.name) - del rpi - remove("/opt/KUNBUS/config.rsc") + # Check default path of config.rsc + for config_file in ("/opt/KUNBUS/config.rsc", "/etc/revpi/config.rsc"): + config_dir = dirname(config_file) + try: + makedirs(config_dir, exist_ok=True) + copyfile(defaultkwargs["configrsc"], config_file) + except PermissionError: + warn(f"Skip test for default location of '{config_file}' - permission denied") + else: + revpimodio2.RevPiModIO(procimg=self.fh_procimg.name) + remove(config_file) # RevPiModIO rpi = self.modio() From a9ec71e9702e0e950ec8d2f2f8382482543ec968 Mon Sep 17 00:00:00 2001 From: Sven Sager Date: Tue, 12 Nov 2024 10:38:16 +0100 Subject: [PATCH 2/3] test: Update runtime warning for exceeded cycle time in mainloop --- tests/mainloop/test_mainloop.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/mainloop/test_mainloop.py b/tests/mainloop/test_mainloop.py index 16aaa22..47149b1 100644 --- a/tests/mainloop/test_mainloop.py +++ b/tests/mainloop/test_mainloop.py @@ -141,14 +141,15 @@ class TestMainloop(TestRevPiModIO): rpi.io.test1.unreg_event() rpi.io.test1.reg_event(xxx_timeout) + rpi.exit() - sleep(0.3) - - # Exceed cylcle time in main loop + # Exceed cycle time in mainloop with self.assertWarnsRegex(RuntimeWarning, r"io refresh time of 0 ms exceeded!"): + rpi = self.modio(debug=False, autorefresh=True) + rpi.mainloop(blocking=False) rpi._imgwriter._refresh = 0.0001 sleep(0.1) - rpi.exit() + rpi.exit() del rpi From f50a7744cdad93cd98e38ff44abb3f6002c6eacd Mon Sep 17 00:00:00 2001 From: Sven Sager Date: Tue, 12 Nov 2024 10:19:56 +0100 Subject: [PATCH 3/3] chore: Increase to RC2 of upcoming Release 2.8.0 --- src/revpimodio2/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/revpimodio2/__about__.py b/src/revpimodio2/__about__.py index f3ceeef..6456434 100644 --- a/src/revpimodio2/__about__.py +++ b/src/revpimodio2/__about__.py @@ -3,4 +3,4 @@ __author__ = "Sven Sager " __copyright__ = "Copyright (C) 2023 Sven Sager" __license__ = "LGPLv2" -__version__ = "2.8.0rc1" +__version__ = "2.8.0rc2"