OSDN Git Service

[lldb] Make TestIOHandlerResizeNoEditline pass with Python 2
authorRaphael Isemann <teemperor@gmail.com>
Tue, 7 Jul 2020 11:30:52 +0000 (13:30 +0200)
committerRaphael Isemann <teemperor@gmail.com>
Tue, 7 Jul 2020 11:54:14 +0000 (13:54 +0200)
io.BytesIO seems to produce a stream in Python 2 which isn't recognized
as a file object in the SWIG API, so this test fails for Python 2 (and I assume
also an old SWIG version needs to be involved).

Instead just open an empty input file which is a file object in all Python
versions to make this test pass everywhere.

lldb/test/API/iohandler/resize/TestIOHandlerResizeNoEditline.py
lldb/test/API/iohandler/resize/input_file [new file with mode: 0644]

index b0ef259..323e511 100644 (file)
@@ -14,7 +14,7 @@ class TestCase(TestBase):
         dbg = lldb.SBDebugger.Create(False)
         # Set the input handle to some stream so that we don't start the
         # editline interface.
-        dbg.SetInputFileHandle(io.BytesIO(b""), True)
+        dbg.SetInputFileHandle(open("input_file"), True)
         opts = lldb.SBCommandInterpreterRunOptions()
         # Launch the command interpreter now.
         dbg.RunCommandInterpreter(True, True, opts, 0, False, False)
diff --git a/lldb/test/API/iohandler/resize/input_file b/lldb/test/API/iohandler/resize/input_file
new file mode 100644 (file)
index 0000000..e69de29