diff --git a/tests/integration/test_ado_e2e.py b/tests/integration/test_ado_e2e.py index e007a5a8..5013fcf1 100644 --- a/tests/integration/test_ado_e2e.py +++ b/tests/integration/test_ado_e2e.py @@ -10,6 +10,7 @@ import os import shutil import subprocess +import sys import tempfile from pathlib import Path @@ -31,7 +32,10 @@ def run_apm_command(cmd: str, cwd: Path, timeout: int = 60) -> subprocess.Comple apm_path = apm_on_path else: # Fallback to local dev venv - apm_path = Path(__file__).parent.parent.parent / ".venv" / "bin" / "apm" + if sys.platform == "win32": + apm_path = Path(__file__).parent.parent.parent / ".venv" / "Scripts" / "apm.exe" + else: + apm_path = Path(__file__).parent.parent.parent / ".venv" / "bin" / "apm" full_cmd = f"{apm_path} {cmd}" result = subprocess.run( diff --git a/tests/integration/test_auto_install_e2e.py b/tests/integration/test_auto_install_e2e.py index 8a014d5e..33b9a468 100644 --- a/tests/integration/test_auto_install_e2e.py +++ b/tests/integration/test_auto_install_e2e.py @@ -69,7 +69,10 @@ def teardown_method(self): """Clean up test environment.""" os.chdir(self.original_dir) if os.path.exists(self.test_dir): - shutil.rmtree(self.test_dir) + # ignore_errors=True: on Windows, recently-terminated subprocesses + # may still hold file locks on the temp directory (WinError 32). + # CI temp dirs are ephemeral — safe to leave behind if needed. + shutil.rmtree(self.test_dir, ignore_errors=True) def test_auto_install_virtual_prompt_first_run(self, temp_e2e_home): """Test auto-install on first run with virtual package reference. @@ -126,8 +129,9 @@ def test_auto_install_virtual_prompt_first_run(self, temp_e2e_home): break # Wait for graceful shutdown + process.stdout.close() try: - process.wait(timeout=5) + process.wait(timeout=10) except subprocess.TimeoutExpired: process.kill() process.wait() @@ -185,7 +189,8 @@ def test_auto_install_uses_cache_on_second_run(self, temp_e2e_home): if "Package installed and ready to run" in line: process.terminate() break - process.wait(timeout=5) + process.stdout.close() + process.wait(timeout=10) except: process.kill() process.wait() @@ -218,7 +223,8 @@ def test_auto_install_uses_cache_on_second_run(self, temp_e2e_home): if "Executing" in line or "Package installed and ready to run" in line: process.terminate() break - process.wait(timeout=5) + process.stdout.close() + process.wait(timeout=10) except: process.kill() process.wait() @@ -265,7 +271,8 @@ def test_simple_name_works_after_install(self, temp_e2e_home): if "Package installed and ready to run" in line: process.terminate() break - process.wait(timeout=5) + process.stdout.close() + process.wait(timeout=10) except: process.kill() process.wait() @@ -294,7 +301,8 @@ def test_simple_name_works_after_install(self, temp_e2e_home): if "Executing" in line or "Auto-discovered" in line: process.terminate() break - process.wait(timeout=5) + process.stdout.close() + process.wait(timeout=10) except: process.kill() process.wait() @@ -340,7 +348,8 @@ def test_auto_install_with_qualified_path(self, temp_e2e_home): if "Package installed and ready to run" in line: process.terminate() break - process.wait(timeout=5) + process.stdout.close() + process.wait(timeout=10) except: process.kill() process.wait()