Skip to content

Commit e1f49f7

Browse files
committed
Fix tests.
1 parent cbaf9cf commit e1f49f7

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

tests/comfy_cli/command/nodes/test_node_install.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,35 @@
1+
import re
12
from unittest.mock import patch
23

34
from typer.testing import CliRunner
45

56
from comfy_cli.command.custom_nodes.command import app
67

7-
runner = CliRunner()
8+
runner = CliRunner(mix_stderr=False)
9+
10+
11+
def strip_ansi(text):
12+
"""Remove ANSI escape sequences from text."""
13+
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
14+
return ansi_escape.sub('', text)
815

916

1017
def test_install_no_deps_option_exists():
1118
"""Test that the --no-deps option appears in the help."""
1219
result = runner.invoke(app, ["install", "--help"])
1320
assert result.exit_code == 0
14-
assert "--no-deps" in result.stdout
15-
assert "Skip dependency installation" in result.stdout
21+
clean_output = strip_ansi(result.stdout)
22+
assert "--no-deps" in clean_output
23+
assert "Skip dependency installation" in clean_output
1624

1725

1826
def test_install_fast_deps_and_no_deps_mutually_exclusive():
1927
"""Test that --fast-deps and --no-deps cannot be used together."""
2028
result = runner.invoke(app, ["install", "test-node", "--fast-deps", "--no-deps"])
2129
assert result.exit_code != 0
22-
assert "Cannot use --fast-deps and --no-deps together" in result.stdout
30+
# Check both stdout and stderr for the error message
31+
output = result.stdout + result.stderr
32+
assert "Cannot use --fast-deps and --no-deps together" in output
2333

2434

2535
def test_install_no_deps_alone_works():

0 commit comments

Comments
 (0)