diff --git a/komodo/cli.py b/komodo/cli.py index e47e836b..2059989c 100755 --- a/komodo/cli.py +++ b/komodo/cli.py @@ -229,7 +229,6 @@ def rsync_komodo_to_destination(release_name: str, destination: str) -> None: shell(f"mv {release_name} .{release_name}") shell(f"rsync -a .{release_name} {destination}") - def move_old_release_from_release_path_if_exists(release_path: Path) -> None: if release_path.exists(): shell(f"mv {str(release_path)} " f"{str(release_path)}.delete-{uuid.uuid4()}") @@ -248,6 +247,7 @@ def delete_old_previously_moved_releases(prefix_path: Path, release_name: Path) "rm -rf -- " + " ".join(release_dir_glob), allow_failure=True, ) + shell(f"rm -rf .{release_name}") def apply_fallback_tmpdir_for_pip_if_set(tmp_dir: Optional[str] = None): diff --git a/tests/test_cli.py b/tests/test_cli.py index 66f94200..47285d4c 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -145,7 +145,6 @@ def test_no_overwrite_by_default(tmpdir): # Try another rerun after we have removed the downloads and remainder from # failed build above: shutil.rmtree(tmpdir / "downloads") - shutil.rmtree(tmpdir / ".existing_release") with pytest.raises(RuntimeError, match="Only bleeding builds can be overwritten"): cli_main() @@ -167,7 +166,6 @@ def test_bleeding_overwrite_by_default(tmpdir): cli_main() # Remove non-interesting leftovers from first build: shutil.rmtree(tmpdir / "downloads") - shutil.rmtree(tmpdir / ".some_bleeding_release") # Assert that we can overwrite the build inside "some_bleeding_release" cli_main() @@ -191,7 +189,6 @@ def test_overwrite_if_option_is_set(tmpdir): cli_main() # Remove non-interesting leftovers from first build: shutil.rmtree(tmpdir / "downloads") - shutil.rmtree(tmpdir / ".some_release") # Assert that we can overwrite the build inside "some_release" cli_main() @@ -234,3 +231,27 @@ def count_release_folders_to_be_deleted() -> int: assert count_release_folders_to_be_deleted() == len(test_dirs) cli_main() assert count_release_folders_to_be_deleted() == 0 + + + +def test_build_removes_hidden_directory_after_rsync(tmpdir): + sys.argv = [ + "kmd", + "--workspace", + str(tmpdir), + os.path.join(_get_test_root(), "data/cli/minimal_release.yml"), + os.path.join(_get_test_root(), "data/cli/minimal_repository.yml"), + "--prefix", + "prefix", + "--release", + "some_bleeding_release", + "--extra-data-dirs", # Required to find test_python_builtin.sh. + os.path.join(_get_test_root(), "data/cli"), + ] + cli_main() + # Remove non-interesting leftovers from first build: + assert not (tmpdir / ".some_bleeding_release").isdir() + shutil.rmtree(tmpdir / "downloads") + + # Assert that we can overwrite the build inside "some_bleeding_release" + cli_main()