Skip to content

Commit 4ef0408

Browse files
committed
tests: added click.unstyle() to strip ANSI codes from the help output in the CLI before asserting
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
1 parent 56a34cb commit 4ef0408

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

tests/unit/cpex/tools/test_cli.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from unittest.mock import MagicMock, patch
1313

1414
# We use typer's CliRunner for testing typer apps
15+
import click
1516
from typer.testing import CliRunner
1617

1718
# Third-Party
@@ -124,12 +125,13 @@ def test_help_exits_zero(self):
124125

125126
def test_help_contains_options(self):
126127
result = runner.invoke(app, ["bootstrap", "--help"])
127-
assert "--destination" in result.output
128-
assert "--template_type" in result.output
129-
assert "--template_url" in result.output
130-
assert "--vcs_ref" in result.output
131-
assert "--no_input" in result.output
132-
assert "--dry_run" in result.output
128+
output = click.unstyle(result.output)
129+
assert "--destination" in output
130+
assert "--template_type" in output
131+
assert "--template_url" in output
132+
assert "--vcs_ref" in output
133+
assert "--no_input" in output
134+
assert "--dry_run" in output
133135

134136

135137
class TestBootstrapDryRun:

0 commit comments

Comments
 (0)