Skip to content

Commit

Permalink
refactor: make configuration-passing from make_dependency_files() to …
Browse files Browse the repository at this point in the history
…make_dependency_file() stricter
  • Loading branch information
jameslamb committed Jan 2, 2024
1 parent 36a4061 commit 42b5e10
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def grid(gridspec):


def make_dependency_file(
file_type, name, config_file, output_dir, conda_channels, dependencies, extras=None
*, file_type, name, config_file, output_dir, conda_channels, dependencies, extras
):
"""Generate the contents of the dependency file.
Expand Down Expand Up @@ -440,13 +440,13 @@ def make_dependency_files(parsed_config, config_file_path, to_stdout):
else get_output_dir(file_type, config_file_path, file_config)
)
contents = make_dependency_file(
file_type,
full_file_name,
config_file_path,
output_dir,
channels,
deduped_deps,
extras,
file_type=file_type,
name=full_file_name,
confige_file=config_file_path,
output_dir=output_dir,
conda_channels=channels,
dependencies=deduped_deps,
extras=extras,
)

if to_stdout:
Expand Down
26 changes: 14 additions & 12 deletions tests/test_rapids_dependency_file_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ def test_make_dependency_file(mock_relpath):
# To make changes, edit {relpath} and run `{cli_name}`.
"""
env = make_dependency_file(
"conda",
"tmp_env.yaml",
"config_file",
"output_path",
["rapidsai", "nvidia"],
["dep1", "dep2"],
file_type="conda",
name="tmp_env.yaml",
config_file="config_file",
output_dir="output_path",
conda_channels=["rapidsai", "nvidia"],
dependencies=["dep1", "dep2"],
extras=None
)
assert env == header + yaml.dump(
{
Expand All @@ -56,12 +57,13 @@ def test_make_dependency_file(mock_relpath):
)

env = make_dependency_file(
"requirements",
"tmp_env.txt",
"config_file",
"output_path",
["rapidsai", "nvidia"],
["dep1", "dep2"],
file_type="requirements",
name="tmp_env.txt",
config_file="config_file",
output_dir="output_path",
conda_channels=["rapidsai", "nvidia"],
dependencies=["dep1", "dep2"],
extras=None
)
assert env == header + "dep1\ndep2\n"

Expand Down

0 comments on commit 42b5e10

Please sign in to comment.