Skip to content

Commit e427005

Browse files
committed
cli: Fix TTY test failing on Python 3.14
Since I don't have Python 3.14 on my system (yet), here are the steps I used to reproduce: sudo dnf install python3.14 python3.14 -m venv /tmp/py3.14 source /tmp/py3.14/bin/activate pip install yaml pathspec python3.14 -m unittest discover # or python3.14 -m unittest tests.test_cli.CommandLineTestCase.test_run_default_format_output_in_tty This commit fixes that by piping *only* `sys.stdout`, not `sys.stderr` too. I'm not sure why I wrote this code in 2016 (see commit a2c68fd), but the new one makes more sense to me now. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2336947
1 parent 728656c commit e427005

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

tests/test_cli.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ def test_run_default_format_output_in_tty(self):
499499

500500
# Create a pseudo-TTY and redirect stdout to it
501501
master, slave = pty.openpty()
502-
sys.stdout = sys.stderr = os.fdopen(slave, 'w')
502+
sys.stdout = os.fdopen(slave, 'w')
503503

504504
with self.assertRaises(SystemExit) as ctx:
505505
cli.run((path, ))
@@ -514,7 +514,6 @@ def test_run_default_format_output_in_tty(self):
514514
out = output.read().replace('\r\n', '\n')
515515

516516
sys.stdout.close()
517-
sys.stderr.close()
518517
output.close()
519518

520519
self.assertEqual(out, (

0 commit comments

Comments
 (0)