Make inputs and backup_dir optional in the config file

They can come from -i and -o; missing ones were rejected as a bad configuration file (exit code 6).
This commit is contained in:
Fuxino
2026-10-21 22:26:55 +02:00
parent e8b088f13e
commit fa3ba2a6bd
3 changed files with 28 additions and 10 deletions
+8 -2
View File
@@ -224,9 +224,15 @@ backup_dir=/backups
sb._read_config(config_file, USER)
def test_inputs_and_backup_dir_optional(tmp_path: Path) -> None:
config_args = sb._read_config(write_config(tmp_path, '[backup]\nkeep=2\n'), USER)
assert config_args['inputs'] is None
assert config_args['output'] is None
assert config_args['keep'] == 2
@pytest.mark.parametrize('text', [
'[backup]\nbackup_dir=/backups\n',
'[backup]\ninputs=/tmp\n',
'[other]\ninputs=/tmp\n',
'inputs=/tmp\n',
])