|
7 | 7 | from typer.testing import CliRunner |
8 | 8 |
|
9 | 9 | from specify_cli import app |
| 10 | +from tests.conftest import strip_ansi |
10 | 11 |
|
11 | 12 |
|
12 | 13 | runner = CliRunner() |
@@ -49,7 +50,8 @@ def _write_invalid_manifest(project, key): |
49 | 50 |
|
50 | 51 |
|
51 | 52 | def _integration_list_row_cells(output: str, key: str) -> list[str]: |
52 | | - row = next(line for line in output.splitlines() if line.startswith(f"│ {key}")) |
| 53 | + plain = strip_ansi(output) |
| 54 | + row = next(line for line in plain.splitlines() if line.startswith(f"│ {key}")) |
53 | 55 | return [cell.strip() for cell in row.split("│")[1:-1]] |
54 | 56 |
|
55 | 57 |
|
@@ -160,8 +162,9 @@ def test_install_already_installed(self, tmp_path): |
160 | 162 | finally: |
161 | 163 | os.chdir(old_cwd) |
162 | 164 | assert result.exit_code == 0 |
163 | | - assert "already installed" in result.output |
164 | | - normalized = " ".join(result.output.split()) |
| 165 | + plain = strip_ansi(result.output) |
| 166 | + assert "already installed" in plain |
| 167 | + normalized = " ".join(plain.split()) |
165 | 168 | assert "specify integration upgrade copilot" in normalized |
166 | 169 | assert "already the default integration" in normalized |
167 | 170 | assert "No files were changed" in normalized |
@@ -197,9 +200,10 @@ def test_install_different_when_one_exists(self, tmp_path): |
197 | 200 | finally: |
198 | 201 | os.chdir(old_cwd) |
199 | 202 | assert result.exit_code != 0 |
200 | | - assert "Installed integrations: copilot" in result.output |
201 | | - assert "Default integration: copilot" in result.output |
202 | | - normalized = " ".join(result.output.split()) |
| 203 | + plain = strip_ansi(result.output) |
| 204 | + assert "Installed integrations: copilot" in plain |
| 205 | + assert "Default integration: copilot" in plain |
| 206 | + normalized = " ".join(plain.split()) |
203 | 207 | assert "To replace the default integration" in normalized |
204 | 208 | assert "specify integration switch claude" in normalized |
205 | 209 | assert "To install 'claude' alongside" in normalized |
@@ -309,9 +313,10 @@ def test_install_multi_unsafe_requires_force(self, tmp_path): |
309 | 313 | finally: |
310 | 314 | os.chdir(old_cwd) |
311 | 315 | assert result.exit_code != 0 |
312 | | - assert "Installed integrations: copilot" in result.output |
313 | | - assert "multi-install safe" in result.output |
314 | | - normalized = " ".join(result.output.split()) |
| 316 | + plain = strip_ansi(result.output) |
| 317 | + assert "Installed integrations: copilot" in plain |
| 318 | + assert "multi-install safe" in plain |
| 319 | + normalized = " ".join(plain.split()) |
315 | 320 | assert "To replace the default integration" in normalized |
316 | 321 | assert "specify integration switch claude" in normalized |
317 | 322 | assert "To install 'claude' alongside" in normalized |
|
0 commit comments