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
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: