From 385d65474b2f61ba87fd1a8baa499f5a76d2938c Mon Sep 17 00:00:00 2001 From: iamashwin99 <ashwin-kumar.karnad@mpsd.mpg.de> Date: Wed, 28 Jun 2023 14:03:45 +0200 Subject: [PATCH] remove trailing slash in mpsd_release input --- src/mpsd_software_manager/mpsd_software.py | 13 +++++-------- tests/test_mpsd_software.py | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/mpsd_software_manager/mpsd_software.py b/src/mpsd_software_manager/mpsd_software.py index 0c17450..50dea3f 100755 --- a/src/mpsd_software_manager/mpsd_software.py +++ b/src/mpsd_software_manager/mpsd_software.py @@ -1260,6 +1260,11 @@ def main(): initialize_environment(Path(os.getcwd())) sys.exit(0) + # sanity check for common mistakes in command line arguments + if args.release.endswith("/"): # happens easily with autocompletion + args.release = args.release.removesuffix("/") + logging.warning(f"Removed trailing slash from release: {args.release}") + # root_dir is the place where this MPSD software instance has its root root_dir = get_root_dir() @@ -1274,14 +1279,6 @@ def main(): log_file, ) - # sanity check for common mistakes in command line arguments - if args.release.endswith("/"): # happens easily with autocompletion - logging.error( - f"You provided mpsd-release='{args.release}'. " - f"Did you mean '{args.release.removesuffix('/')}'?" - ) - sys.exit(1) - # Check the command and run related function if args.action == "remove": remove_environment(args.release, root_dir, args.package_set) diff --git a/tests/test_mpsd_software.py b/tests/test_mpsd_software.py index 79fc35c..01eca53 100644 --- a/tests/test_mpsd_software.py +++ b/tests/test_mpsd_software.py @@ -575,6 +575,7 @@ def test_interface(tmp_path): # check that the help message is printed when no arguments are provided # check that the help message is printed when -h is provided # check that the error messages are also logged to the log file + # check that `/` in release is handled correctly # other tests to add (ideally) -- GitLab