mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-05-03 15:32:15 +00:00
Merge pull request #10831 from xzmeng/fix-log
feat: auto-create logs dir if it's absent
This commit is contained in:
@@ -86,7 +86,7 @@ def test_set_loggers_Filehandler(tmp_path):
|
||||
logger = logging.getLogger()
|
||||
orig_handlers = logger.handlers
|
||||
logger.handlers = []
|
||||
logfile = tmp_path / "ft_logfile.log"
|
||||
logfile = tmp_path / "logs/ft_logfile.log"
|
||||
config = {
|
||||
"verbosity": 2,
|
||||
"logfile": str(logfile),
|
||||
@@ -107,6 +107,29 @@ def test_set_loggers_Filehandler(tmp_path):
|
||||
logger.handlers = orig_handlers
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows")
|
||||
def test_set_loggers_Filehandler_without_permission(tmp_path):
|
||||
logger = logging.getLogger()
|
||||
orig_handlers = logger.handlers
|
||||
logger.handlers = []
|
||||
|
||||
try:
|
||||
tmp_path.chmod(0o400)
|
||||
logfile = tmp_path / "logs/ft_logfile.log"
|
||||
config = {
|
||||
"verbosity": 2,
|
||||
"logfile": str(logfile),
|
||||
}
|
||||
|
||||
setup_logging_pre()
|
||||
with pytest.raises(OperationalException):
|
||||
setup_logging(config)
|
||||
|
||||
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.")
|
||||
def test_set_loggers_journald(mocker):
|
||||
logger = logging.getLogger()
|
||||
|
||||
Reference in New Issue
Block a user