Skip to content

Commit 82a57b7

Browse files
Jayman2000adrienverge
authored andcommitted
tests: Restore stdout
Before this commit, test_run_default_format_output_in_tty() changed the value of sys.stdout, but it would never change it back to the original value. This commit makes sure that it gets changed back. At the moment, this commit doesn’t make a user-visible difference. A future commit will add a new test named test_ignored_from_file_with_multiple_encodings(). That new test requires that stdout gets restored, or else it will fail.
1 parent 5f57f9e commit 82a57b7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/test_cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ def test_run_default_format_output_in_tty(self):
498498
path = os.path.join(self.wd, 'a.yaml')
499499

500500
# Create a pseudo-TTY and redirect stdout to it
501+
old_stdout = sys.stdout
501502
master, slave = pty.openpty()
502503
sys.stdout = os.fdopen(slave, 'w')
503504

@@ -515,6 +516,7 @@ def test_run_default_format_output_in_tty(self):
515516

516517
sys.stdout.close()
517518
output.close()
519+
sys.stdout = old_stdout
518520

519521
self.assertEqual(out, (
520522
f'\033[4m{path}\033[0m\n'

0 commit comments

Comments
 (0)