tests: reset permissions on tmp-path

to facilitate cleanup
This commit is contained in:
Matthias
2024-10-25 07:22:11 +02:00
parent e7b0e3293d
commit c4cbf6de3b
+13 -10
View File
@@ -113,18 +113,21 @@ def test_set_loggers_Filehandler_without_permission(tmp_path):
orig_handlers = logger.handlers orig_handlers = logger.handlers
logger.handlers = [] logger.handlers = []
tmp_path.chmod(0o400) try:
logfile = tmp_path / "logs/ft_logfile.log" tmp_path.chmod(0o400)
config = { logfile = tmp_path / "logs/ft_logfile.log"
"verbosity": 2, config = {
"logfile": str(logfile), "verbosity": 2,
} "logfile": str(logfile),
}
setup_logging_pre() setup_logging_pre()
with pytest.raises(OperationalException): with pytest.raises(OperationalException):
setup_logging(config) setup_logging(config)
logger.handlers = orig_handlers logger.handlers = orig_handlers
finally:
tmp_path.chmod(0o700)
@pytest.mark.skip(reason="systemd is not installed on every system, so we're not testing this.") @pytest.mark.skip(reason="systemd is not installed on every system, so we're not testing this.")