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

Verify --channel is not passed without --user #14443

Merged
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
2 changes: 2 additions & 0 deletions conan/cli/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ def validate_common_graph_args(args):
if args.requires and (args.name or args.version or args.user or args.channel):
raise ConanException("Can't use --name, --version, --user or --channel arguments with "
"--requires")
if args.channel and not args.user:
raise ConanException("Can't specify --channel without --user")
if not args.path and not args.requires and not args.tool_requires:
raise ConanException("Please specify a path to a conanfile or a '--requires=<ref>'")
if args.path and (args.requires or args.tool_requires):
Expand Down
3 changes: 3 additions & 0 deletions conans/test/integration/command/install/install_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def test_install_reference_error(client):
# Test to check the "conan install <path> <reference>" command argument
client.run("install --requires=pkg/0.1@myuser/testing --user=user --channel=testing", assert_error=True)
assert "ERROR: Can't use --name, --version, --user or --channel arguments with --requires" in client.out
client.save({"conanfile.py": GenConanfile("pkg", "1.0")})
client.run("install . --channel=testing", assert_error=True)
assert "ERROR: Can't specify --channel without --user" in client.out


def test_install_args_error():
Expand Down