#500 Check repo name for correct format
Merged by onosek. Opened by onosek.
onosek/rpkg clone_repo_check  into  master

Download 500.patch

During 'clone' command, passing URL with as a 'repo' argument
is a common mistake. Instead, just the name of the repository is sufficient.
URL base of the repo is already specified in the config.
This fix adds check for this mistake on command-line input.

JIRA: RHELCMP-434

Signed-off-by: Ondřej Nosek onosek@redhat.com

After a couple of hours looking at it, I am helpless. The test fails and I am not able to force it to work properly. assertRaises should pass, but it does not with argparse.ArgumentTypeError. If I replace it with rpkgError it behaves correctly.
But argparse.ArgumentTypeError should stay there to provide correct message to the user.

I think argparse handles the ArgumentTypeError internally and calls sys.exit. Maybe the test should check that SystemExit was raised, and proper error printed to stderr.

Even with rpkgError the test is failing for me.

rebased onto 8da9448d02367deb2fdf7b6fc5ea58b3a1f2971a

Great! I didn't realize that the exception has changed.

Pull-Request has been merged by onosek

Metadata