Skip to content

Commit

Permalink
Revert sdist check to make it more testable
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
  • Loading branch information
astrojuanlu committed Jun 5, 2023
1 parent 15bdb95 commit fedebbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions kedro/framework/cli/micropkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,10 @@ def _unpack_sdist(location: str, destination: Path, fs_args: str | None) -> None
sdist_file = list(destination.glob("*.tar.gz"))
# `--no-deps --no-binary :all:` should fetch only one source distribution file,
# and CLI should fail if that's not the case.
# No need to check for zero sdists, in that case the previous command would fail.
if len(sdist_file) > 1:
if len(sdist_file) != 1:
file_names = [sf.name for sf in sdist_file]
raise KedroCliError(
f"More than 1 sdist files found: {file_names}. "
f"More than 1 or no sdist files found: {file_names}. "
f"There has to be exactly one source distribution file."
)
with tarfile.open(sdist_file[0], "r:gz") as fs_file:
Expand Down
4 changes: 2 additions & 2 deletions tests/framework/cli/micropkg/test_micropkg_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,14 +708,14 @@ def test_pull_from_pypi_more_than_one_sdist_file(
)

assert result.exit_code
assert "Error: More than 1 sdist files found:" in result.output
assert "Error: More than 1 or no sdist files found:" in result.output

def test_pull_unsupported_protocol_by_fsspec(
self, fake_project_cli, fake_metadata, tmp_path, mocker
):
protocol = "unsupported"
exception_message = f"Protocol not known: {protocol}"
error_message = "Error: More than 1 sdist files found:"
error_message = "Error: More than 1 or no sdist files found:"
package_path = f"{protocol}://{PIPELINE_NAME}"

python_call_mock = mocker.patch("kedro.framework.cli.micropkg.python_call")
Expand Down

0 comments on commit fedebbb

Please sign in to comment.