From 1af7d86b88f91ad9070bbbbf6cc89c3f29069714 Mon Sep 17 00:00:00 2001 From: imSp4rky Date: Wed, 23 Sep 2026 16:07:33 -0600 Subject: [PATCH] test(import): assert on the ClickException, not the wrapped error panel A long tmp path on macOS and Windows runners made rich-click split the message across lines. --- tests/core/test_import_command.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/core/test_import_command.py b/tests/core/test_import_command.py index 480e11a1..86e22717 100644 --- a/tests/core/test_import_command.py +++ b/tests/core/test_import_command.py @@ -7,6 +7,7 @@ import json from pathlib import Path from typing import Any +import click import pytest from click.testing import CliRunner @@ -86,8 +87,10 @@ def test_import_rejects_a_file_that_is_not_an_export(tmp_path: Path, forwarded: export = tmp_path / "export.json" export.write_text(json.dumps({"hello": "world"}), encoding="utf-8") - result = CliRunner().invoke(import_cli, [str(export)]) + # rich-click wraps the error panel to the terminal width, so a long tmp path can split the phrase in the output + result = CliRunner().invoke(import_cli, [str(export)], standalone_mode=False) assert result.exit_code != 0 - assert "is not a usable export file" in result.output + assert isinstance(result.exception, click.ClickException) + assert "is not a usable export file" in result.exception.message assert forwarded == []