Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inconsistent error messages involving output-file #191

Merged
merged 6 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions acquire/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ def check_and_set_acquire_args(
if not args.upload:
# check output related configuration
if (args.children or len(args.targets) > 1) and args.output_file:
raise ValueError("--children can not be used with --output_file. Use --output instead")
raise ValueError("--children can not be used with --output-file. Use --output instead")
elif args.output_file and (not args.output_file.parent.is_dir() or args.output_file.is_dir()):
raise ValueError("--output_file must be a path to a file in an existing directory")
raise ValueError("--output-file must be a path to a file in an existing directory")
elif args.output and not args.output.is_dir():
raise ValueError(f"Output directory doesn't exist or is a file: {args.output}")

Expand Down
6 changes: 3 additions & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,21 +229,21 @@ def test_check_and_set_acquire_args_output(children: bool, arg_name: str, output
True,
"output_file",
get_mock_path(is_dir=False),
"--children can not be used with --output_file. Use --output instead",
"--children can not be used with --output-file. Use --output instead",
),
# Output_file is a directory
(
False,
"output_file",
get_mock_path(),
"--output_file must be a path to a file in an existing directory",
"--output-file must be a path to a file in an existing directory",
),
# Output_file has a non-existing parent directory
(
False,
"output_file",
get_mock_path(is_dir=False, parent_is_dir=False),
"--output_file must be a path to a file in an existing directory",
"--output-file must be a path to a file in an existing directory",
),
# Output is a non-existing directory
(
Expand Down
Loading