Merge pull request #2071 from pbiering/fix-2070

sharing/fix: indent bug
This commit is contained in:
Peter Bieringer
2026-04-05 16:44:19 +02:00
committed by GitHub
5 changed files with 49 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
# Changelog
## 3.7.1.dev
* Fix: share address book collection as birthday calendar not working on non-DEBUG level
## 3.7.0

View File

@@ -55,7 +55,7 @@ build-backend = "setuptools.build_meta"
[tool.tox]
min_version = "4.0"
envlist = ["py", "flake8", "isort", "mypy", "integ_test", "html5validator"]
envlist = ["py_loglevel_info", "py_radicale_loglevel_info", "py", "flake8", "isort", "mypy", "integ_test", "html5validator"]
[tool.tox.env.py]
extras = ["test"]
@@ -65,6 +65,21 @@ deps = [
]
commands = [["pytest", "-r", "s", "--cov", "--cov-report=term", "--cov-report=xml", "."]]
[tool.tox.env.py_loglevel_info]
extras = ["test"]
deps = [
"pytest"
]
commands = [["pytest", "-r", "s", "--log-level", "INFO", "."]]
[tool.tox.env.py_radicale_loglevel_info]
extras = ["test"]
setenv = { PYTEST_RADICALE_LOGLEVEL = "info" }
deps = [
"pytest"
]
commands = [["pytest", "-r", "s", "--log-level", "INFO", "."]]
[tool.tox.env.flake8]
deps = ["flake8==7.1.0"]
commands = [["flake8", "."]]

View File

@@ -512,14 +512,14 @@ class Item:
if self.vobject_item.name != "VCARD":
if logger.isEnabledFor(logging.DEBUG):
logger.debug("TRACE/item/convert_vcf_to_ics: item is not a VCARD (skip): %r", self.href)
return None
return None
else:
if logger.isEnabledFor(logging.DEBUG):
logger.debug("TRACE/item/convert_vcf_to_ics: item is a VCARD (ok): %r", self.href)
if not hasattr(self.vobject_item, "bday"):
if logger.isEnabledFor(logging.DEBUG):
logger.debug("TRACE/item/convert_vcf_to_ics: miss bday (skip): %r", self.href)
return None
return None
else:
pass

View File

@@ -42,8 +42,18 @@ from radicale import app, config, types, utils, xmlutils
RESPONSES = Dict[str, Union[int, Dict[str, Tuple[int, ET.Element]], vobject.base.Component]]
# Enable debug output
radicale.log.logger.setLevel(logging.DEBUG)
if 'PYTEST_RADICALE_LOGLEVEL' in os.environ:
# Set custom loglevel
level = os.environ["PYTEST_RADICALE_LOGLEVEL"]
logging.info("Setting loglevel by environment (PYTEST_RADICALE_LOGLEVEL): %s", level)
else:
# Default level
level = "debug"
logging.info("Setting loglevel by default: %s", level)
if isinstance(level, str):
level = getattr(logging, level.upper())
assert isinstance(level, int)
radicale.log.logger.setLevel(level)
class BaseTest:

View File

@@ -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/")