Skip to content

Commit

Permalink
Fix run_experiment not handling param_files of None
Browse files Browse the repository at this point in the history
Fixes #119
  • Loading branch information
WarmCyan committed Dec 6, 2023
1 parent ddd53fd commit baa8661
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions curifactory/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

def run_experiment( # noqa: C901 -- TODO: this does need to be broken up at some point
experiment_name,
param_files,
param_files=None,
overwrite_override=None,
cache_dir_override=None,
mngr: ArtifactManager = None,
Expand Down Expand Up @@ -170,8 +170,9 @@ def run_experiment( # noqa: C901 -- TODO: this does need to be broken up at som

if run_string is None:
run_string = f"experiment {experiment_name}"
for param_file in param_files:
run_string += f" -p {param_file}"
if param_files is not None:
for param_file in param_files:
run_string += f" -p {param_file}"
if param_set_names is not None:
for param_set_name in param_set_names:
run_string += f" --names {param_set_name}"
Expand Down
6 changes: 6 additions & 0 deletions test/test_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,12 @@ def test_empty_parameters_errors(clear_filesystem):
)


def test_experiment_none_parameters_runs(clear_filesystem):
"""Not passing in any value to run_experiment for parameters should be equivalent to passing [] or implicitly passing the experiment's name."""
results, manager = run_experiment("simple_cache")
assert len(manager.records) == 4


def test_invalid_args_names_errors(clear_filesystem):
"""Using a --names flag but with a non-existant parameterset name should error."""
with pytest.raises(RuntimeError) as exc_info:
Expand Down

0 comments on commit baa8661

Please sign in to comment.