tenseleyflow/documentlanguagemodel / be573f9

Browse files

tests: COLUMNS=200 + ANSI/whitespace strip in CLI help-text assertion (CI runners wrap narrow)

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
be573f904a6b567d8489f3de1b2663e9a363cad3
Parents
f91b74e
Tree
a11855e

1 changed file

StatusFile+-
M tests/unit/cli/test_export_sway_json.py 14 3
tests/unit/cli/test_export_sway_json.pymodified
@@ -167,8 +167,19 @@ class TestExportCliFlagWiring:
167
 
167
 
168
         from dlm.cli.app import app
168
         from dlm.cli.app import app
169
 
169
 
170
-        runner = CliRunner()
170
+        # Force a wide terminal so typer/Rich don't wrap the long
171
+        # ``--emit-sway-json`` flag across lines (CI's runner has a
172
+        # narrow default that breaks substring asserts).
173
+        runner = CliRunner(env={"COLUMNS": "200", "TERM": "dumb"})
171
         result = runner.invoke(app, ["export", "--help"])
174
         result = runner.invoke(app, ["export", "--help"])
172
         assert result.exit_code == 0, result.output
175
         assert result.exit_code == 0, result.output
173
-        assert "--emit-sway-json" in result.output
176
+        # Strip any ANSI escapes so a substring match is robust to
174
-        assert "sway.yaml" in result.output
177
+        # color codes inserted at arbitrary positions.
178
+        import re
179
+
180
+        plain = re.sub(r"\x1b\[[0-9;]*m", "", result.output)
181
+        # Collapse whitespace so wrap-induced line breaks within the
182
+        # flag name still match — belt + braces with the COLUMNS env.
183
+        plain = re.sub(r"\s+", " ", plain)
184
+        assert "--emit-sway-json" in plain, plain
185
+        assert "sway.yaml" in plain, plain