aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_repl.py
diff options
context:
space:
mode:
authorƁukasz Langa <lukasz@langa.pl>2024-09-06 21:28:29 +0200
committerGitHub <noreply@github.com>2024-09-06 21:28:29 +0200
commit033510e11dff742d9626b9fd895925ac77f566f1 (patch)
tree312afe4e65696542145747bc525868fb1816a7d6 /Lib/test/test_repl.py
parent0c080d7c77d826c1afab7bd6b73f61e714cffcb7 (diff)
downloadcpython-033510e11dff742d9626b9fd895925ac77f566f1.tar.gz
cpython-033510e11dff742d9626b9fd895925ac77f566f1.zip
gh-120221: Support KeyboardInterrupt in asyncio REPL (#123795)
This switches the main pyrepl event loop to always be non-blocking so that it can listen to incoming interruptions from other threads. This also resolves invalid display of exceptions from other threads (gh-123178). This also fixes freezes with pasting and an active input hook.
Diffstat (limited to 'Lib/test/test_repl.py')
-rw-r--r--Lib/test/test_repl.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_repl.py b/Lib/test/test_repl.py
index cd8ef0f1057..7a7285a1a2f 100644
--- a/Lib/test/test_repl.py
+++ b/Lib/test/test_repl.py
@@ -242,6 +242,7 @@ class TestInteractiveInterpreter(unittest.TestCase):
def test_asyncio_repl_is_ok(self):
m, s = pty.openpty()
cmd = [sys.executable, "-I", "-m", "asyncio"]
+ env = os.environ.copy()
proc = subprocess.Popen(
cmd,
stdin=s,
@@ -249,7 +250,7 @@ class TestInteractiveInterpreter(unittest.TestCase):
stderr=s,
text=True,
close_fds=True,
- env=os.environ,
+ env=env,
)
os.close(s)
os.write(m, b"await asyncio.sleep(0)\n")
@@ -270,7 +271,7 @@ class TestInteractiveInterpreter(unittest.TestCase):
proc.kill()
exit_code = proc.wait()
- self.assertEqual(exit_code, 0)
+ self.assertEqual(exit_code, 0, "".join(output))
class TestInteractiveModeSyntaxErrors(unittest.TestCase):