Skip to content

Commit

Permalink
Merge pull request #613 from launchableinc/add-validation-no-build-an…
Browse files Browse the repository at this point in the history
…d-session-option

Add validation when both option --no-build and --session are set
  • Loading branch information
Konboi authored Aug 17, 2023
2 parents 01dfefd + 94d7327 commit 2d4a5a3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions launchable/commands/record/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ def tests(
raise click.UsageError(
'The cli already created `.launchable` file. If you want to use `--no-build` option, please remove `.launchable` file before executing.') # noqa: E501

if is_no_build and session:
click.echo(
click.style(
"WARNING: `--session` and `--no-build` are set.\nUsing --session option value ({}) and ignoring `--no-build` option".format(session), # noqa: E501
fg='yellow'),
err=True)
is_no_build = False

try:
if is_no_build:
session_id = "builds/{}/test_sessions/{}".format(NO_BUILD_BUILD_NAME, NO_BUILD_TEST_SESSION_ID)
Expand Down
8 changes: 8 additions & 0 deletions launchable/commands/subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ def subset(
)
sys.exit(1)

if is_no_build and session:
click.echo(
click.style(
"WARNING: `--session` and `--no-build` are set.\nUsing --session option value ({}) and ignoring `--no-build` option".format(session), # noqa: E501
fg='yellow'),
err=True)
is_no_build = False

session_id = None
try:
session_id = find_or_create_session(
Expand Down

0 comments on commit 2d4a5a3

Please sign in to comment.