Skip to content

Commit 62619bd

Browse files
authored
Fix test_command_line for Python 3.15 (#14040)
1 parent b9d5d2b commit 62619bd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/test_command_line.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import pytest
88

9+
from sphinx._cli.util.errors import strip_escape_sequences
910
from sphinx.cmd import make_mode
1011
from sphinx.cmd.build import get_parser
1112
from sphinx.cmd.make_mode import run_make_mode
@@ -150,7 +151,7 @@ def test_build_main_parse_arguments_pos_intermixed(
150151
if broken_argparse:
151152
with pytest.raises(SystemExit):
152153
parse_arguments(args)
153-
stderr = capsys.readouterr().err.splitlines()
154+
stderr = strip_escape_sequences(capsys.readouterr().err).splitlines()
154155
assert stderr[-1].endswith('error: unrecognized arguments: filename1 filename2')
155156
else:
156157
assert parse_arguments(args) == EXPECTED_BUILD_MAIN
@@ -178,7 +179,7 @@ def test_make_mode_parse_arguments_pos_last(
178179
]
179180
with pytest.raises(SystemExit):
180181
run_make_mode(args)
181-
stderr = capsys.readouterr().err.splitlines()
182+
stderr = strip_escape_sequences(capsys.readouterr().err).splitlines()
182183
assert stderr[-1].endswith('error: argument --builder/-b: expected one argument')
183184

184185

@@ -195,7 +196,7 @@ def test_make_mode_parse_arguments_pos_middle(
195196
]
196197
with pytest.raises(SystemExit):
197198
run_make_mode(args)
198-
stderr = capsys.readouterr().err.splitlines()
199+
stderr = strip_escape_sequences(capsys.readouterr().err).splitlines()
199200
assert stderr[-1].endswith('error: argument --builder/-b: expected one argument')
200201

201202

@@ -232,5 +233,5 @@ def test_make_mode_parse_arguments_pos_intermixed(
232233
]
233234
with pytest.raises(SystemExit):
234235
run_make_mode(args)
235-
stderr = capsys.readouterr().err.splitlines()
236+
stderr = strip_escape_sequences(capsys.readouterr().err).splitlines()
236237
assert stderr[-1].endswith('error: argument --builder/-b: expected one argument')

0 commit comments

Comments
 (0)