1212import moldflow
1313
1414from moldflow_cli .commands import build_cli_app
15+ from tests .api .unit_tests .conftest import strip_ansi
1516
1617runner = CliRunner ()
1718
@@ -32,17 +33,18 @@ def test_help_runs_without_synergy(self):
3233 # Help should not need to touch Synergy/COM at all.
3334 mock_ctx_synergy .assert_not_called ()
3435 mock_fact_synergy .assert_not_called ()
35- assert "Moldflow command-line interface" in result .stdout
36- assert "Start with 'list' to discover targets" in result .stdout
37- assert "describe <target>" in result .stdout
38- assert "invoke <target>" in result .stdout
36+ output = strip_ansi (result .stdout )
37+ assert "Moldflow command-line interface" in output
38+ assert "Start with 'list' to discover targets" in output
39+ assert "describe <target>" in output
40+ assert "invoke <target>" in output
3941
4042 def test_help_shows_global_no_color_option (self ):
4143 """Global help should advertise the output-styling toggle."""
4244 app = build_cli_app ()
4345 result = runner .invoke (app , ["--no-color" , "--help" ])
4446 assert result .exit_code == 0
45- assert "--no-color" in result .stdout
47+ assert "--no-color" in strip_ansi ( result .stdout )
4648
4749 def test_subcommand_help_runs_without_synergy (self ):
4850 """Subcommand help should be available without creating Synergy/COM objects."""
@@ -59,17 +61,20 @@ def test_subcommand_help_runs_without_synergy(self):
5961 assert invoke_help .exit_code == 0
6062 mock_ctx_synergy .assert_not_called ()
6163 mock_fact_synergy .assert_not_called ()
64+ list_output = strip_ansi (list_help .stdout )
65+ describe_output = strip_ansi (describe_help .stdout )
66+ invoke_output = strip_ansi (invoke_help .stdout )
6267 assert (
6368 "Discover invokable targets and the next command to run for each one"
64- in list_help . stdout
69+ in list_output
6570 )
66- assert "--json" in list_help . stdout
67- assert "--with-describe" in list_help . stdout
71+ assert "--json" in list_output
72+ assert "--with-describe" in list_output
6873 assert (
6974 "Inspect a target's signature, docs, examples, and structured invoke template"
70- in describe_help . stdout
75+ in describe_output
7176 )
72- assert "Run a Moldflow target with named parameters or JSON input" in invoke_help . stdout
77+ assert "Run a Moldflow target with named parameters or JSON input" in invoke_output
7378
7479 def test_global_no_color_option_configures_cli_output (self ):
7580 """Global --no-color should reconfigure shared console output before dispatch."""
0 commit comments