Skip to content

Commit 86137b6

Browse files
committed
test: strip ansi to make asserts work
1 parent 81e9ecd commit 86137b6

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

tests/integrations/test_cli.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ def test_shared_infra_overwrites_existing_files_with_force(self, tmp_path):
267267
def test_shared_infra_skip_warning_displayed(self, tmp_path, capsys):
268268
"""Console warning is displayed when files are skipped."""
269269
from specify_cli import _install_shared_infra
270+
from tests.conftest import strip_ansi
270271

271272
project = tmp_path / "warn-test"
272273
project.mkdir()
@@ -279,10 +280,11 @@ def test_shared_infra_skip_warning_displayed(self, tmp_path, capsys):
279280
_install_shared_infra(project, "sh", force=False)
280281

281282
captured = capsys.readouterr()
282-
assert "already exist and were not updated" in captured.out
283-
assert "specify init --here --force" in captured.out
283+
output = strip_ansi(captured.out)
284+
assert "already exist and were not updated" in output
285+
assert "specify init --here --force" in output
284286
# Rich may wrap long lines; normalize whitespace for the second command
285-
normalized = " ".join(captured.out.split())
287+
normalized = " ".join(output.split())
286288
assert "specify integration upgrade --force" in normalized
287289

288290
def test_shared_infra_warns_when_manifest_cannot_be_loaded(self, tmp_path, capsys):

tests/integrations/test_integration_subcommand.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from typer.testing import CliRunner
88

99
from specify_cli import app
10+
from tests.conftest import strip_ansi
1011

1112

1213
runner = CliRunner()
@@ -182,7 +183,8 @@ def test_install_already_installed_non_default_guides_use(self, tmp_path):
182183
finally:
183184
os.chdir(old_cwd)
184185
assert result.exit_code == 0
185-
normalized = " ".join(result.output.split())
186+
output = strip_ansi(result.output)
187+
normalized = " ".join(output.split())
186188
assert "already installed" in normalized
187189
assert "specify integration use codex" in normalized
188190
assert "specify integration upgrade codex" in normalized

0 commit comments

Comments
 (0)