From cd98d0fd9bc2be427507c2d6f6215e9e45da0590 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Sun, 5 Apr 2026 16:13:04 +0200 Subject: [PATCH] storage/hook/tests: skip if loglevel is not DEBUG and set explicit capture of DEBUG log --- radicale/tests/test_storage.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/radicale/tests/test_storage.py b/radicale/tests/test_storage.py index 70248504..9414108a 100644 --- a/radicale/tests/test_storage.py +++ b/radicale/tests/test_storage.py @@ -189,8 +189,10 @@ class TestMultiFileSystem(BaseTest): assert "\r\nUID:%s\r\n" % uid in answer @pytest.mark.skipif(not shutil.which("flock"), reason="flock command not found") + @pytest.mark.skipif(radicale.log.logger.getEffectiveLevel() == logging.INFO, reason="requires loglevel DEBUG") def test_hook_placeholders_PUT(self, caplog) -> None: - """Run hook and check placeholders: PUT""" + """Run hook and check placeholders via debug log: PUT""" + caplog.set_level(logging.DEBUG) self.configure({"storage": {"hook": "echo \"hook-json {'user':'%(user)s', 'cwd':'%(cwd)s', 'path':'%(path)s', 'request':'%(request)s', 'to_path':'%(to_path)s'}\""}}) found = 0 self.mkcalendar("/calendar.ics/") @@ -230,8 +232,10 @@ class TestMultiFileSystem(BaseTest): logging.info("Logging contains expected hook line, found=%d data=%r", found, d) @pytest.mark.skipif(not shutil.which("flock"), reason="flock command not found") + @pytest.mark.skipif(radicale.log.logger.getEffectiveLevel() == logging.INFO, reason="requires loglevel DEBUG") def test_hook_placeholders_DELETE(self, caplog) -> None: - """Run hook and check placeholders: DELETE""" + """Run hook and check placeholders via debug log: DELETE""" + caplog.set_level(logging.DEBUG) self.configure({"storage": {"hook": "echo \"hook-json {'user':'%(user)s', 'cwd':'%(cwd)s', 'path':'%(path)s', 'request':'%(request)s', 'to_path':'%(to_path)s'}\""}}) found = 0 self.mkcalendar("/calendar.ics/") @@ -272,8 +276,10 @@ class TestMultiFileSystem(BaseTest): logging.info("Logging contains expected hook line, found=%d data=%r", found, d) @pytest.mark.skipif(not shutil.which("flock"), reason="flock command not found") + @pytest.mark.skipif(radicale.log.logger.getEffectiveLevel() == logging.INFO, reason="requires loglevel DEBUG") def test_hook_placeholders_MKCALENDAR(self, caplog) -> None: - """Run hook and check placeholders: MKCALENDAR""" + """Run hook and check placeholders via debug log: MKCALENDAR""" + caplog.set_level(logging.DEBUG) self.configure({"storage": {"hook": "echo \"hook-json {'user':'%(user)s', 'cwd':'%(cwd)s', 'path':'%(path)s', 'request':'%(request)s', 'to_path':'%(to_path)s'}\""}}) found = 0 self.mkcalendar("/calendar.ics/") @@ -310,8 +316,10 @@ class TestMultiFileSystem(BaseTest): logging.info("Logging contains expected hook line, found=%d data=%r", found, d) @pytest.mark.skipif(not shutil.which("flock"), reason="flock command not found") + @pytest.mark.skipif(radicale.log.logger.getEffectiveLevel() == logging.INFO, reason="requires loglevel DEBUG") def test_hook_placeholders_MKCOL(self, caplog) -> None: - """Run hook and check placeholders: MKCOL""" + """Run hook and check placeholders via debug log: MKCOL""" + caplog.set_level(logging.DEBUG) self.configure({"storage": {"hook": "echo \"hook-json {'user':'%(user)s', 'cwd':'%(cwd)s', 'path':'%(path)s', 'request':'%(request)s', 'to_path':'%(to_path)s'}\""}}) found = 0 self.mkcol("/user1/") @@ -348,8 +356,10 @@ class TestMultiFileSystem(BaseTest): logging.info("Logging contains expected hook line, found=%d data=%r", found, d) @pytest.mark.skipif(not shutil.which("flock"), reason="flock command not found") + @pytest.mark.skipif(radicale.log.logger.getEffectiveLevel() == logging.INFO, reason="requires loglevel DEBUG") def test_hook_placeholders_PROPPATCH(self, caplog) -> None: - """Run hook and check placeholders: PROPPATCH""" + """Run hook and check placeholders via debug log: PROPPATCH""" + caplog.set_level(logging.DEBUG) self.configure({"storage": {"hook": "echo \"hook-json {'user':'%(user)s', 'cwd':'%(cwd)s', 'path':'%(path)s', 'request':'%(request)s', 'to_path':'%(to_path)s'}\""}}) found = 0 self.mkcalendar("/calendar.ics/") @@ -388,8 +398,10 @@ class TestMultiFileSystem(BaseTest): logging.info("Logging contains expected hook line, found=%d data=%r", found, d) @pytest.mark.skipif(not shutil.which("flock"), reason="flock command not found") + @pytest.mark.skipif(radicale.log.logger.getEffectiveLevel() == logging.INFO, reason="requires loglevel DEBUG") def test_hook_placeholders_MOVE(self, caplog) -> None: - """Run hook and check placeholders: MOVE""" + """Run hook and check placeholders via debug log: MOVE""" + caplog.set_level(logging.DEBUG) self.configure({"storage": {"hook": "echo \"hook-json {'user':'%(user)s', 'cwd':'%(cwd)s', 'path':'%(path)s', 'request':'%(request)s', 'to_path':'%(to_path)s'}\""}}) found = 0 self.mkcalendar("/calendar.ics/")