Skip to content

Commit c95c035

Browse files
committed
fixup! update news entry
1 parent 549a8d2 commit c95c035

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Lib/test/test_pyrepl/test_pyrepl.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import select
77
import subprocess
88
import sys
9-
from unittest import TestCase
9+
from unittest import TestCase, skipUnless
1010
from unittest.mock import patch
1111
from test.support import force_not_colorized
1212

@@ -22,6 +22,10 @@
2222
from _pyrepl.readline import ReadlineAlikeReader, ReadlineConfig
2323
from _pyrepl.readline import multiline_input as readline_multiline_input
2424

25+
try:
26+
import pty
27+
except ImportError:
28+
pty = None
2529

2630
class TestCursorPosition(TestCase):
2731
def prepare_reader(self, events):
@@ -835,16 +839,16 @@ def test_bracketed_paste_single_line(self):
835839
self.assertEqual(output, input_code)
836840

837841

842+
@skipUnless(pty, "requires pty")
838843
class TestMain(TestCase):
839844
@force_not_colorized
840845
def test_exposed_globals_in_repl(self):
841846
expected_output = (
842-
'["__annotations__", "__builtins__", "__doc__", "__loader__", '
843-
'"__name__", "__package__", "__spec__"]'
847+
"[\'__annotations__\', \'__builtins__\', \'__doc__\', \'__loader__\', "
848+
"\'__name__\', \'__package__\', \'__spec__\']"
844849
)
845850
output, exit_code = self.run_repl(["sorted(dir())", "exit"])
846851
self.assertEqual(exit_code, 0)
847-
output = output.replace("\'", '"')
848852
self.assertIn(expected_output, output)
849853

850854
def test_dumb_terminal_exits_cleanly(self):
@@ -857,10 +861,6 @@ def test_dumb_terminal_exits_cleanly(self):
857861
self.assertNotIn("Traceback", output)
858862

859863
def run_repl(self, repl_input: str | list[str], env: dict | None = None) -> tuple[str, int]:
860-
try:
861-
import pty
862-
except ImportError:
863-
self.skipTest("pty module not available")
864864
master_fd, slave_fd = pty.openpty()
865865
process = subprocess.Popen(
866866
[sys.executable, "-i", "-u"],

0 commit comments

Comments
 (0)