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

List EVC tree once only when querying with name #642

Merged
merged 1 commit into from
Aug 27, 2021
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
1 change: 1 addition & 0 deletions src/orion/core/cli/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def main(args):

if args["name"]:
query["name"] = args["name"]
query["version"] = args.get("version", None) or 1

experiments = get_storage().fetch_experiments(query)

Expand Down
43 changes: 43 additions & 0 deletions tests/functional/commands/test_list_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,46 @@ def test_exp_family_branch_same_name(
└test_single_exp_child-v1
"""
)


def test_exp_family_branch_same_name_with_name_query(
three_experiments_branch_same_name, monkeypatch, capsys
):
"""Test that two experiments with the same name and different versions are correctly printed
when name is queried
"""
monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__)))

orion.core.cli.main(["list", "--name", "test_single_exp"])

captured = capsys.readouterr().out

assert (
captured
== """\
test_single_exp-v1┐
└test_single_exp-v2┐
└test_single_exp_child-v1
"""
)


def test_exp_family_branch_same_name_with_name_version_query(
three_experiments_branch_same_name, monkeypatch, capsys
):
"""Test that two experiments with the same name and different versions are correctly printed
when name and version is queried
"""
monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__)))

orion.core.cli.main(["list", "--name", "test_single_exp", "--version", "2"])

captured = capsys.readouterr().out

assert (
captured
== """\
test_single_exp-v2┐
└test_single_exp_child-v1
"""
)