fix arg
This commit is contained in:
parent
4dd3df4024
commit
bd1e68730a
3 changed files with 15 additions and 2 deletions
|
|
@ -310,7 +310,7 @@ def main() -> List[Tuple[Subscription, FileHandlerTransactionLog]]:
|
|||
elif os.path.isfile(DEFAULT_CONFIG_FILE_NAME):
|
||||
config = ConfigFile.from_file_path(DEFAULT_CONFIG_FILE_NAME)
|
||||
else:
|
||||
logger.info("No config specified, using defaults")
|
||||
logger.info("No config specified, using defaults.")
|
||||
|
||||
transaction_logs: List[Tuple[Subscription, FileHandlerTransactionLog]] = []
|
||||
|
||||
|
|
|
|||
|
|
@ -88,8 +88,8 @@ def _add_shared_arguments(arg_parser: argparse.ArgumentParser, suppress_defaults
|
|||
MainArguments.CONFIG.long,
|
||||
metavar="CONFIGPATH",
|
||||
type=str,
|
||||
# Default is set downstream
|
||||
help=f"path to the config yaml, uses {DEFAULT_CONFIG_FILE_NAME} if not provided",
|
||||
default=argparse.SUPPRESS if suppress_defaults else None, # Default is set downstream
|
||||
)
|
||||
arg_parser.add_argument(
|
||||
MainArguments.DRY_RUN.short,
|
||||
|
|
|
|||
|
|
@ -97,6 +97,19 @@ def test_args_after_sub_work(mock_sys_exit):
|
|||
assert Logger._LOGGER_LEVEL == LoggerLevels.VERBOSE
|
||||
|
||||
|
||||
def test_no_config_works(mock_sys_exit):
|
||||
with mock_sys_exit(expected_exit_code=0), patch.object(
|
||||
sys,
|
||||
"argv",
|
||||
["ytdl-sub", "sub", "--log-level", "verbose"],
|
||||
), patch("ytdl_sub.cli.main._download_subscriptions_from_yaml_files") as mock_sub:
|
||||
main()
|
||||
|
||||
assert mock_sub.call_count == 1
|
||||
assert mock_sub.call_args.kwargs["subscription_paths"] == ["subscriptions.yaml"]
|
||||
assert Logger._LOGGER_LEVEL == LoggerLevels.VERBOSE
|
||||
|
||||
|
||||
def test_no_positional_arg_command(mock_sys_exit):
|
||||
with mock_sys_exit(expected_exit_code=1), patch.object(
|
||||
sys,
|
||||
|
|
|
|||
Loading…
Reference in a new issue