diff --git a/src/rapids_dependency_file_generator/_config.py b/src/rapids_dependency_file_generator/_config.py index d650037..550f8d3 100644 --- a/src/rapids_dependency_file_generator/_config.py +++ b/src/rapids_dependency_file_generator/_config.py @@ -178,7 +178,7 @@ def get_extras(): ) -def _parse_requirement(requirement: typing.Union[str, dict[str, str]]) -> typing.Union[str, PipRequirements]: +def _parse_requirement(requirement: typing.Union[str, dict[str, list[str]]]) -> typing.Union[str, PipRequirements]: if isinstance(requirement, str): return requirement diff --git a/tests/examples/invalid/pip-no-list/dependencies.yaml b/tests/examples/invalid/pip-no-list/dependencies.yaml new file mode 100644 index 0000000..98bc6fd --- /dev/null +++ b/tests/examples/invalid/pip-no-list/dependencies.yaml @@ -0,0 +1,18 @@ +# tests that dfg rejects a config where 'pip:' in a conda requirements is a single string +# (it should always be an array of packages) +files: + build: + output: conda + includes: + - build +channels: + - rapidsai + - conda-forge +dependencies: + build: + common: + - output_types: [conda] + packages: + - beep-boop=1.2.3 + - pip + - pip: pandas diff --git a/tests/test_config.py b/tests/test_config.py index 823fda7..2aab8af 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -38,7 +38,7 @@ def test_parse_outputs(input, output): ["input", "output"], [ ("package", "package"), - ({"pip": "package"}, _config.PipRequirements(pip="package")), + ({"pip": ["package", "other-package"]}, _config.PipRequirements(pip=["package", "other-package"])), ({"other": "invalid"}, KeyError), ], )