From 794e905d03b04bc7b823dc6fcade4f4302ce4d08 Mon Sep 17 00:00:00 2001 From: Juliya Smith Date: Thu, 14 Dec 2023 12:26:04 -0600 Subject: [PATCH] fix: issue with pm manifest cache --- src/ape/api/projects.py | 2 ++ tests/integration/cli/test_pm.py | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/ape/api/projects.py b/src/ape/api/projects.py index 9ccd759837..9099df8c2d 100644 --- a/src/ape/api/projects.py +++ b/src/ape/api/projects.py @@ -469,6 +469,8 @@ def _extract_local_manifest( **extras, ) + # Replace the dependency's manifest with the temp project's. + self.replace_manifest(project.manifest) return project.manifest def _get_sources(self, project: ProjectAPI) -> List[Path]: diff --git a/tests/integration/cli/test_pm.py b/tests/integration/cli/test_pm.py index af7d17b4e1..a593bc72b8 100644 --- a/tests/integration/cli/test_pm.py +++ b/tests/integration/cli/test_pm.py @@ -14,13 +14,17 @@ def test_install_path_not_exists(ape_cli, runner): @run_once -def test_install_path_to_local_package(ape_cli, runner): - project = "with-contracts" - path = Path(__file__).parent / "projects" / project - result = runner.invoke(ape_cli, ["pm", "install", path.as_posix(), "--name", project]) +def test_install_path_to_local_package(ape_cli, runner, project): + project_name = "with-contracts" + path = Path(__file__).parent / "projects" / project_name + name = path.stem + result = runner.invoke(ape_cli, ["pm", "install", path.as_posix(), "--name", project_name]) assert result.exit_code == 0, result.output assert f"Package '{path.as_posix()}' installed." + # Ensure was installed correctly. + assert (project.dependency_manager.DATA_FOLDER / "packages" / name).is_dir() + @run_once def test_install_path_to_local_config_file(ape_cli, runner): @@ -188,11 +192,16 @@ def test_remove_cancel(ape_cli, runner): @skip_projects_except("only-dependencies") -def test_remove_invalid_version(ape_cli, runner): +def test_remove_invalid_version(ape_cli, runner, project): + package_name = "dependency-in-project-only" + # Install packages runner.invoke(ape_cli, ["pm", "install", ".", "--force"]) - package_name = "dependency-in-project-only" + # Ensure was installed correctly. + assert package_name in project.dependencies + assert (project.dependency_manager.DATA_FOLDER / "packages" / package_name).is_dir() + invalid_version = "0.0.0" result = runner.invoke(ape_cli, ["pm", "remove", package_name, invalid_version])