Skip to content

Commit fbf118b

Browse files
committed
Fixed unit test problem
1 parent fb8e50b commit fbf118b

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

pilot/scripts/open_remote_file.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,16 @@
4949
logger = logging.getLogger(__name__)
5050

5151

52-
def get_args() -> argparse.Namespace:
52+
def get_args(argv: list = None) -> argparse.Namespace:
5353
"""
5454
Return the args from the arg parser.
5555
56-
:return: args (arg parser object).
56+
Args:
57+
argv: optional list of arguments to parse (defaults to sys.argv when None,
58+
which is the normal runtime behaviour). Pass an explicit list in tests.
59+
60+
Returns:
61+
Parsed argument namespace.
5762
"""
5863
arg_parser = argparse.ArgumentParser()
5964

@@ -89,7 +94,7 @@ def get_args() -> argparse.Namespace:
8994
default=False,
9095
help='Do not write the pilot log to file')
9196

92-
args = arg_parser.parse_args()
97+
args = arg_parser.parse_args(argv)
9398
if not args.turls and not args.turl_file:
9499
arg_parser.error('one of --turls or --turl-file is required')
95100
return args

0 commit comments

Comments
 (0)