Skip to content

Commit dfd3992

Browse files
committed
do not update the sys.stdin in console tests
1 parent 8046eac commit dfd3992

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

Lib/test/test_msvcrt.py

+4-14
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,8 @@ def test_getwch(self):
7575
h = msvcrt.get_osfhandle(stdin.fileno())
7676
flush_console_input_buffer(h)
7777

78-
old_stdin = sys.stdin
79-
try:
80-
sys.stdin = stdin
81-
write_input(stdin, c_encoded)
82-
self.assertEqual(msvcrt.getwch(), c)
83-
finally:
84-
sys.stdin = old_stdin
78+
write_input(stdin, c_encoded)
79+
self.assertEqual(msvcrt.getwch(), c)
8580

8681
def test_getche(self):
8782
msvcrt.ungetch(b'c')
@@ -92,13 +87,8 @@ def test_getwche(self):
9287
h = msvcrt.get_osfhandle(stdin.fileno())
9388
flush_console_input_buffer(h)
9489

95-
old_stdin = sys.stdin
96-
try:
97-
sys.stdin = stdin
98-
write_input(stdin, c_encoded)
99-
self.assertEqual(msvcrt.getwche(), c)
100-
finally:
101-
sys.stdin = old_stdin
90+
write_input(stdin, c_encoded)
91+
self.assertEqual(msvcrt.getwche(), c)
10292

10393
def test_putch(self):
10494
msvcrt.putch(b'c')

0 commit comments

Comments
 (0)