Skip to content

Commit

Permalink
fixup! update news entry
Browse files Browse the repository at this point in the history
  • Loading branch information
pablogsal committed Jun 11, 2024
1 parent 549a8d2 commit c95c035
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Lib/test/test_pyrepl/test_pyrepl.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import select
import subprocess
import sys
from unittest import TestCase
from unittest import TestCase, skipUnless
from unittest.mock import patch
from test.support import force_not_colorized

Expand All @@ -22,6 +22,10 @@
from _pyrepl.readline import ReadlineAlikeReader, ReadlineConfig
from _pyrepl.readline import multiline_input as readline_multiline_input

try:
import pty
except ImportError:
pty = None

class TestCursorPosition(TestCase):
def prepare_reader(self, events):
Expand Down Expand Up @@ -835,16 +839,16 @@ def test_bracketed_paste_single_line(self):
self.assertEqual(output, input_code)


@skipUnless(pty, "requires pty")
class TestMain(TestCase):
@force_not_colorized
def test_exposed_globals_in_repl(self):
expected_output = (
'["__annotations__", "__builtins__", "__doc__", "__loader__", '
'"__name__", "__package__", "__spec__"]'
"[\'__annotations__\', \'__builtins__\', \'__doc__\', \'__loader__\', "
"\'__name__\', \'__package__\', \'__spec__\']"
)
output, exit_code = self.run_repl(["sorted(dir())", "exit"])
self.assertEqual(exit_code, 0)
output = output.replace("\'", '"')
self.assertIn(expected_output, output)

def test_dumb_terminal_exits_cleanly(self):
Expand All @@ -857,10 +861,6 @@ def test_dumb_terminal_exits_cleanly(self):
self.assertNotIn("Traceback", output)

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

0 comments on commit c95c035

Please sign in to comment.