Skip to content

Commit 1be35d5

Browse files
committed
Force ANSI escape sequences in CI tests - Set explicit color_system='256' in all Console creations - Add environment variables (FORCE_COLOR, TERM, COLORTERM) to GitHub Actions - Update test console configuration with force_terminal=True and color_system='256' - Add environment variables to CliRunner in CLI tests - Update snapshots to include ANSI escape sequences
1 parent 90dd369 commit 1be35d5

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
env:
3030
FORCE_COLOR: 1
3131
TERM: xterm-256color
32+
COLORTERM: truecolor
33+
NO_COLOR: ""
3234

3335
- name: Run linting
3436
run: |

md2term.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ def convert(markdown_text: str, width: Optional[int] = None) -> None:
517517
width = shutil.get_terminal_size().columns
518518

519519
# Create console with proper width
520-
console = Console(width=width, force_terminal=True)
520+
console = Console(width=width, force_terminal=True, color_system="256")
521521

522522
# Use the unified streaming renderer for consistent output
523523
renderer = StreamingRenderer(console)
@@ -536,7 +536,7 @@ def process_stream(input_stream: TextIO, width: Optional[int] = None) -> None:
536536
width = shutil.get_terminal_size().columns
537537

538538
# Create console with proper width
539-
console = Console(width=width, force_terminal=True)
539+
console = Console(width=width, force_terminal=True, color_system="256")
540540

541541
# Create streaming renderer
542542
renderer = StreamingRenderer(console)
@@ -564,7 +564,7 @@ def process_character_stream(input_stream: TextIO, width: Optional[int] = None)
564564
width = shutil.get_terminal_size().columns
565565

566566
# Create console with proper width
567-
console = Console(width=width, force_terminal=True)
567+
console = Console(width=width, force_terminal=True, color_system="256")
568568

569569
# Create streaming renderer
570570
renderer = StreamingRenderer(console)
@@ -599,7 +599,7 @@ def process_smart_stream(input_stream: TextIO, width: Optional[int] = None) -> N
599599
width = shutil.get_terminal_size().columns
600600

601601
# Create console with proper width
602-
console = Console(width=width, force_terminal=True)
602+
console = Console(width=width, force_terminal=True, color_system="256")
603603

604604
# Create streaming renderer
605605
renderer = StreamingRenderer(console)

tests/test_md2term.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@
1515

1616
def create_test_console(output, width=80):
1717
"""Create a console with consistent settings for testing."""
18-
return Console(file=output, width=width, force_terminal=True, color_system="256")
18+
return Console(
19+
file=output,
20+
width=width,
21+
force_terminal=True,
22+
color_system="256",
23+
legacy_windows=False,
24+
force_interactive=False
25+
)
1926

2027

2128
class TestMarkdownFeatures:

0 commit comments

Comments
 (0)