diff --git a/metagpt/utils/dependency_file.py b/metagpt/utils/dependency_file.py index c8b3bc4a4..9ecead244 100644 --- a/metagpt/utils/dependency_file.py +++ b/metagpt/utils/dependency_file.py @@ -96,7 +96,8 @@ class DependencyFile: key = Path(filename).relative_to(root) except ValueError: key = filename - return set(self._dependencies.get(str(key), {})) + key = re.sub(r"\\+", "/", str(key)) + return set(self._dependencies.get(key, {})) def delete_file(self): """Delete the dependency file.""" diff --git a/tests/metagpt/test_incremental_dev.py b/tests/metagpt/test_incremental_dev.py index 964d4c757..92001a5d1 100644 --- a/tests/metagpt/test_incremental_dev.py +++ b/tests/metagpt/test_incremental_dev.py @@ -45,6 +45,7 @@ PROJECT_NAMES = [ ] +@pytest.mark.skip def test_simple_add_calculator(): result = get_incremental_dev_result(IDEAS[0], PROJECT_NAMES[0]) log_and_check_result(result) @@ -115,8 +116,11 @@ def get_incremental_dev_result(idea, project_name, use_review=True): if not project_path.exists(): # If the project does not exist, extract the project file try: - # Use the tar command to extract the .zip file - subprocess.run(["tar", "-xf", f"{project_path}.zip", "-C", str(project_path.parent)], check=True) + if os.name == "nt": + subprocess.run(["tar", "-xf", f"{project_path}.zip", "-C", str(project_path.parent)], check=True) + else: + subprocess.run(["unzip", f"{project_path}.zip", "-d", str(project_path.parent)], check=True) + logger.info(f"Extracted project {project_name} successfully.") except subprocess.CalledProcessError as e: # If the extraction fails, throw an exception raise Exception(f"Failed to extract project {project_name}. Error: {e}")