Skip to content

Commit

Permalink
added suggest export command after add (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wxl19980214 authored Jun 14, 2022
1 parent e7f0151 commit c1238e5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/soopervisor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ def add(env_name, backend, preset):
'env_name': env_name
})

click.echo('Environment added, to export it:\n'
f'\t $ soopervisor export {env_name}\n'
'To force execution of all tasks:\n'
f'\t $ soopervisor export {env_name} '
'--mode force\n')


@cli.command()
@click.argument('env_name')
Expand Down
22 changes: 22 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@ def monkeypatch_external(monkeypatch):
# TODO Add test with lambda


@pytest.mark.parametrize('args, backend', [
[['add', 'serve', '--backend', 'argo-workflows'], Backend.argo_workflows],
[['add', 'serve', '--backend', 'airflow'], Backend.airflow],
[['add', 'serve', '--backend', 'kubeflow'], Backend.kubeflow],
[['add', 'serve', '--backend', 'aws-batch'], Backend.aws_batch],
[['add', 'serve', '--backend', 'slurm'], Backend.slurm],
],
ids=[
'argo',
'airflow',
'kubeflow',
'batch',
'slurm',
])
def test_suggestion_after_add(args, backend, tmp_sample_project):
runner = CliRunner()
result = runner.invoke(cli, args, catch_exceptions=False)

assert result.exit_code == 0
assert "Environment added, to export it" in result.output


def test_add_unknown_backend():
runner = CliRunner()
result = runner.invoke(cli, ['add', 'something', '--backend', 'unknown'],
Expand Down

0 comments on commit c1238e5

Please sign in to comment.