diff --git a/tests/integration/test_ado_e2e.py b/tests/integration/test_ado_e2e.py index 5013fcf1..4b46455a 100644 --- a/tests/integration/test_ado_e2e.py +++ b/tests/integration/test_ado_e2e.py @@ -45,7 +45,9 @@ def run_apm_command(cmd: str, cwd: Path, timeout: int = 60) -> subprocess.Comple capture_output=True, text=True, timeout=timeout, - env={**os.environ} + env={**os.environ}, + encoding='utf-8', + errors='replace' ) return result diff --git a/tests/integration/test_guardrailing_hero_e2e.py b/tests/integration/test_guardrailing_hero_e2e.py index e59366f4..b79f8299 100644 --- a/tests/integration/test_guardrailing_hero_e2e.py +++ b/tests/integration/test_guardrailing_hero_e2e.py @@ -48,7 +48,9 @@ def run_command(cmd, check=True, capture_output=True, timeout=180, cwd=None, sho text=True, timeout=timeout, cwd=cwd, - env=env + env=env, + encoding='utf-8', + errors='replace' ) result_capture = subprocess.run( cmd, @@ -58,7 +60,9 @@ def run_command(cmd, check=True, capture_output=True, timeout=180, cwd=None, sho text=True, timeout=timeout, cwd=cwd, - env=env + env=env, + encoding='utf-8', + errors='replace' ) result.stdout = result_capture.stdout result.stderr = result_capture.stderr @@ -71,7 +75,9 @@ def run_command(cmd, check=True, capture_output=True, timeout=180, cwd=None, sho text=True, timeout=timeout, cwd=cwd, - env=env + env=env, + encoding='utf-8', + errors='replace' ) return result except subprocess.TimeoutExpired: @@ -126,7 +132,7 @@ def test_2_minute_guardrailing_flow(self, apm_binary): assert project_dir.exists(), "Project directory not created" assert (project_dir / "apm.yml").exists(), "apm.yml not created" - print("✓ Project initialized") + print("[OK] Project initialized") # Step 2: apm install microsoft/apm-sample-package print("\n=== Step 2: apm install microsoft/apm-sample-package ===") @@ -144,7 +150,7 @@ def test_2_minute_guardrailing_flow(self, apm_binary): assert design_pkg.exists(), "design-guidelines package not installed" assert (design_pkg / "apm.yml").exists(), "design-guidelines apm.yml not found" - print("✓ design-guidelines installed") + print("[OK] design-guidelines installed") # Step 3: apm install github/awesome-copilot/instructions/code-review-generic.instructions.md print("\n=== Step 3: apm install github/awesome-copilot/instructions/code-review-generic.instructions.md ===") @@ -164,7 +170,7 @@ def test_2_minute_guardrailing_flow(self, apm_binary): instruction_files = list(instruction_pkg.rglob("*.instructions.md")) assert len(instruction_files) > 0, "instruction file not downloaded into virtual package" - print("✓ code-review-generic instruction installed") + print("[OK] code-review-generic instruction installed") # Step 4: apm compile print("\n=== Step 4: apm compile ===") @@ -182,9 +188,9 @@ def test_2_minute_guardrailing_flow(self, apm_binary): assert "review" in agents_content.lower() or "code" in agents_content.lower(), \ "AGENTS.md doesn't contain code-review content from awesome-copilot" - print(f"✓ AGENTS.md generated ({len(agents_content)} bytes)") - print(f" Contains design instructions: ✓") - print(f" Contains code-review instructions: ✓") + print(f"[OK] AGENTS.md generated ({len(agents_content)} bytes)") + print(f" Contains design instructions: [OK]") + print(f" Contains code-review instructions: [OK]") # Step 5: apm run design-review print("\n=== Step 5: apm run design-review ===") @@ -198,7 +204,9 @@ def test_2_minute_guardrailing_flow(self, apm_binary): stderr=subprocess.STDOUT, text=True, cwd=project_dir, - env=env + env=env, + encoding='utf-8', + errors='replace' ) # Monitor output for success signals @@ -218,7 +226,7 @@ def test_2_minute_guardrailing_flow(self, apm_binary): "Subprocess execution:", # Codex about to run ]): prompt_started = True - print("✓ design-review prompt execution started") + print("[OK] design-review prompt execution started") break # Terminate the process gracefully @@ -240,13 +248,13 @@ def test_2_minute_guardrailing_flow(self, apm_binary): assert prompt_started or "design-review" in full_output, \ f"Prompt execution didn't start correctly. Output:\n{full_output}" - print("✓ design-review prompt found and started successfully") + print("[OK] design-review prompt found and started successfully") - print("\n=== 2-Minute Guardrailing Hero Scenario: PASSED ✨ ===") - print("✓ Project initialization") - print("✓ Multiple APM package installation") - print("✓ AGENTS.md compilation with combined instructions") - print("✓ Prompt execution from installed package") + print("\n=== 2-Minute Guardrailing Hero Scenario: PASSED ===") + print("[OK] Project initialization") + print("[OK] Multiple APM package installation") + print("[OK] AGENTS.md compilation with combined instructions") + print("[OK] Prompt execution from installed package") if __name__ == "__main__": diff --git a/tests/integration/test_mcp_registry_e2e.py b/tests/integration/test_mcp_registry_e2e.py index 02b8b870..6decf06c 100644 --- a/tests/integration/test_mcp_registry_e2e.py +++ b/tests/integration/test_mcp_registry_e2e.py @@ -77,7 +77,9 @@ def run_command(cmd, check=True, capture_output=True, timeout=180, cwd=None, inp text=True, timeout=timeout, cwd=cwd, - input=input_text + input=input_text, + encoding='utf-8', + errors='replace' ) return result except subprocess.TimeoutExpired: @@ -148,13 +150,13 @@ def test_mcp_search_command(self, temp_e2e_home, apm_binary): assert "github" in output, "Search results should contain GitHub servers" assert "mcp" in output, "Search results should be about MCP servers" - print(f"✓ MCP search found GitHub servers:\n{result.stdout[:500]}...") + print(f"[OK] MCP search found GitHub servers:\n{result.stdout[:500]}...") # Test search with limit result = run_command(f"{apm_binary} mcp search filesystem --limit 3", timeout=30) assert result.returncode == 0, f"MCP search with limit failed: {result.stderr}" - print(f"✓ MCP search with limit works") + print(f"[OK] MCP search with limit works") def test_mcp_show_command(self, temp_e2e_home, apm_binary): """Test MCP registry server details functionality.""" @@ -171,7 +173,7 @@ def test_mcp_show_command(self, temp_e2e_home, apm_binary): # The show command displays installation guide - look for key elements assert "installation" in output or "install" in output or "command" in output, "Should show installation info" - print(f"✓ MCP show displays server details:\n{result.stdout[:500]}...") + print(f"[OK] MCP show displays server details:\n{result.stdout[:500]}...") @pytest.mark.skipif(not GITHUB_TOKEN, reason="GITHUB_TOKEN required for installation tests") @pytest.mark.skipif(not _is_registry_healthy(), reason="GitHub MCP server configured as remote-only (no packages) - skipping installation tests") @@ -228,7 +230,7 @@ def test_registry_installation_with_codex(self, temp_e2e_home, apm_binary): f.write("scripts:\n") f.write(' start: codex run start --param name="$name"\n') - print(f"✓ Created apm.yml with MCP dependencies") + print(f"[OK] Created apm.yml with MCP dependencies") # Step 3: Test installation with environment variable prompting print("Testing MCP installation with environment variable handling...") @@ -280,7 +282,7 @@ def test_registry_installation_with_codex(self, temp_e2e_home, apm_binary): # For servers without proper package configuration, expect minimal config if command == "unknown" and not args: - print(f"✓ Server configured with basic setup: {server_name}") + print(f"[OK] Server configured with basic setup: {server_name}") elif command == "docker": # For Docker servers, verify args contain proper Docker command structure if isinstance(args, list): @@ -291,15 +293,15 @@ def test_registry_installation_with_codex(self, temp_e2e_home, apm_binary): # Should contain docker run command structure assert "run" in args_str or len(args) > 0, f"Docker server should have proper args: {args}" - print(f"✓ Docker server configured with args: {args}") + print(f"[OK] Docker server configured with args: {args}") else: # For other servers, just verify config structure - print(f"✓ Server configured: command={command}, args={args}") + print(f"[OK] Server configured: command={command}, args={args}") break assert server_found, "Test server not found in configuration" - print(f"✓ Verified {len(mcp_servers)} MCP servers in Codex config") + print(f"[OK] Verified {len(mcp_servers)} MCP servers in Codex config") except Exception as e: pytest.fail(f"Failed to parse Codex config: {e}\nContent: {config_content}") @@ -391,7 +393,7 @@ def test_empty_string_handling_e2e(self, temp_e2e_home, apm_binary): # GitHub server has limited package config - accept basic setup if command == "unknown" and not args: - print(f"✓ Copilot server with basic setup: {server_name}") + print(f"[OK] Copilot server with basic setup: {server_name}") elif command == "docker": if isinstance(args, list): args_str = " ".join(args) @@ -399,21 +401,21 @@ def test_empty_string_handling_e2e(self, temp_e2e_home, apm_binary): args_str = str(args) assert "run" in args_str or len(args) > 0, f"Docker server should have valid args: {args}" - print(f"✓ Copilot Docker server with args: {args}") + print(f"[OK] Copilot Docker server with args: {args}") else: - print(f"✓ Copilot server configured: {command}") + print(f"[OK] Copilot server configured: {command}") break if not server_found and result.returncode == 0: pytest.fail("Test server not configured in Copilot despite successful installation") - print(f"✓ Copilot configuration tested with {len(mcp_servers)} servers") + print(f"[OK] Copilot configuration tested with {len(mcp_servers)} servers") except json.JSONDecodeError as e: pytest.fail(f"Invalid JSON in Copilot config: {e}\nContent: {config_content}") else: - print("⚠ Copilot configuration not created (binary may not be available)") + print("[WARN] Copilot configuration not created (binary may not be available)") # This is OK for testing - we're validating the adapter logic def test_empty_string_handling_e2e(self, temp_e2e_home, apm_binary): @@ -474,7 +476,7 @@ def test_empty_string_handling_e2e(self, temp_e2e_home, apm_binary): assert value != "", f"GITHUB_TOKEN should not be empty: {line}" assert value.strip() != "", f"GITHUB_TOKEN should not be whitespace: {line}" - print("✓ Empty string handling verified in configuration") + print("[OK] Empty string handling verified in configuration") @pytest.mark.skipif(not _is_registry_healthy(), reason="GitHub MCP server configured as remote-only (no packages) - skipping installation tests") def test_cross_adapter_consistency(self, temp_e2e_home, apm_binary): @@ -521,7 +523,7 @@ def test_cross_adapter_consistency(self, temp_e2e_home, apm_binary): codex_config = Path(temp_e2e_home) / ".codex" / "config.toml" if codex_config.exists(): - print("✓ Found Codex configuration to verify") + print("[OK] Found Codex configuration to verify") config_content = codex_config.read_text() @@ -536,7 +538,7 @@ def test_cross_adapter_consistency(self, temp_e2e_home, apm_binary): server_found = any("github" in name.lower() for name in servers.keys()) assert server_found, "Codex configuration should contain GitHub server" - print("✓ Codex configuration contains GitHub server") + print("[OK] Codex configuration contains GitHub server") else: pytest.fail("No Codex configuration found to verify") @@ -615,9 +617,9 @@ def test_duplication_prevention_e2e(self, temp_e2e_home, apm_binary): if isinstance(args, list) and len(args) > 20: # Very high threshold for duplication pytest.fail(f"GitHub server args seem excessively duplicated: {len(args)} items") - print(f"✓ Configuration verified - no excessive duplication detected") + print(f"[OK] Configuration verified - no excessive duplication detected") - print("✓ Duplication prevention working correctly") + print("[OK] Duplication prevention working correctly") class TestSlugCollisionPrevention: