You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# under class TestPyReplCompleter(line ≈ 806) Lib/test/test_pyrepl/test_pyrepl.pydeftest_completion_menu_cleared_after_KeyboardInterrupt(self):
events=itertools.chain(
code_to_events("int."),
[
Event(evt="key", data="\t", raw=bytearray(b"\t")),
Event(evt="key", data="\t", raw=bytearray(b"\t")),
Event(evt="key", data="\x03", raw=bytearray(b"\x03")), # Ctrl+C
],
)
namespace= {}
reader=self.prepare_reader(events, namespace)
output=multiline_input(reader, namespace)
self.assertEqual(clean_screen(reader.screen), "int.") # asser condition isn't good now
I found the KeyboardInterrupt caused by Event(evt="key", data="\x03", raw=bytearray(b"\x03")) will be directly captured by the test program itself
# result of ".\python.bat -m test test_pyrepl.test_pyrepl -v"== Tests result: INTERRUPTED ==1 test omitted:
test_pyrepl.test_pyrepl
Test suite interrupted by signal SIGINT.
Total duration: 1.3 sec
Total tests: run=0
Total test files: run=0/1
Result: INTERRUPTED
@cfbolz Hi there, I've seen you in several REPL-related issues both in CPython and PyPy repositories. You must be an expert in this area. I wonder if you have any insights on this current issue?
@ambv Hello, since hearing the good news that this issue has been fixed, I've been trying to write tests again for my first CPython PR #128467. However, after several days of attempts, I still haven't been able to do it. It seems a bit too difficult for me to handle the KeyboardInterrupt, and you appear to be an expert in this area. I was wondering if I could get some help and guidance from you.
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
When I was writing test for PR #128467
I found the
KeyboardInterrupt
caused byEvent(evt="key", data="\x03", raw=bytearray(b"\x03"))
will be directly captured by the test program itselfSo I added a traceback in the test function
I also added
traceback.print_exc()
inLib/_pyrepl/simple_interact.py(line ≈ 164)
(the user-facing REPL)recompile and run
At the same time, the related error in the test is
So the
KeyboardInterrupt
in test did not behave correctly as if the user pressedCtrl+C
, but was directly captured by the test programCPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
The text was updated successfully, but these errors were encountered: