Skip to content

Handle status --name <exp> when empty #270

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

Merged
merged 1 commit into from
Aug 26, 2019
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
4 changes: 4 additions & 0 deletions src/orion/core/cli/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def main(args):

experiments = get_experiments(args)

if not experiments:
print("No experiment found")
return

if args.get('name'):
print_status(experiments[0], all_trials=args.get('all'), collapse=args.get('collapse'))
return
Expand Down
12 changes: 11 additions & 1 deletion tests/functional/commands/test_status_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_no_experiments(clean_db, monkeypatch, capsys):

captured = capsys.readouterr().out

assert captured == ""
assert captured == "No experiment found\n"


def test_experiment_without_trials_wout_ac(clean_db, one_experiment, capsys):
Expand Down Expand Up @@ -870,6 +870,16 @@ def test_three_related_branch_w_ac(clean_db, three_family_branch_with_trials, ca
assert captured == expected


def test_no_experiments_w_name(clean_db, monkeypatch, capsys):
"""Test status when --name <exp> does not exist."""
monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__)))
orion.core.cli.main(['status', '--name', 'test_ghost_exp'])

captured = capsys.readouterr().out

assert captured == "No experiment found\n"


def test_experiment_wout_child_w_name(clean_db, unrelated_with_trials, capsys):
"""Test status with the name argument and no child."""
orion.core.cli.main(['status', '--name', 'test_single_exp'])
Expand Down