From 041ae67fd9dcf685dc2057210fa88fb2026f0336 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Wed, 20 Jan 2021 09:04:04 +0100 Subject: [PATCH] optionally hand in command line arguments to CLI functions Allows easier testing. --- nominatim/cli.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nominatim/cli.py b/nominatim/cli.py index 70481b4a..02b30f19 100644 --- a/nominatim/cli.py +++ b/nominatim/cli.py @@ -68,10 +68,11 @@ class CommandlineParser: """ Parse the command line arguments of the program and execute the appropriate subcommand. """ - args = self.parser.parse_args() + args = self.parser.parse_args(args=kwargs.get('cli_args')) if args.subcommand is None: - return self.parser.print_help() + self.parser.print_help() + return 1 for arg in ('module_dir', 'osm2pgsql_path', 'phplib_dir', 'data_dir', 'phpcgi_path'): setattr(args, arg, Path(kwargs[arg])) -- 2.45.1