[Lldb-commits] [lldb] 17bdb7a - [lldb/Test] Convert stdout to str by calling decode('utf-8') on it.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 13 09:50:54 PDT 2020


Author: Jonas Devlieghere
Date: 2020-03-13T09:50:41-07:00
New Revision: 17bdb7a17912bb4d961cf292c035b08c9d0c13ba

URL: https://github.com/llvm/llvm-project/commit/17bdb7a17912bb4d961cf292c035b08c9d0c13ba
DIFF: https://github.com/llvm/llvm-project/commit/17bdb7a17912bb4d961cf292c035b08c9d0c13ba.diff

LOG: [lldb/Test] Convert stdout to str by calling decode('utf-8') on it.

Make sure both arguments to assertIn are of type str. This should fix
the following error:

TypeError: a bytes-like object is required, not 'str'.

Added: 
    

Modified: 
    lldb/test/API/functionalities/reproducers/attach/TestReproducerAttach.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/functionalities/reproducers/attach/TestReproducerAttach.py b/lldb/test/API/functionalities/reproducers/attach/TestReproducerAttach.py
index 48659e46ebd7..9bc123a5d051 100644
--- a/lldb/test/API/functionalities/reproducers/attach/TestReproducerAttach.py
+++ b/lldb/test/API/functionalities/reproducers/attach/TestReproducerAttach.py
@@ -53,7 +53,8 @@ def test_create_after_attach_with_fork(self):
                                    stdin=subprocess.PIPE,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE)
-        outs, errs = capture.communicate()
+        outs, _ = capture.communicate()
+        outs = outs.decode('utf-8')
         self.assertIn('Process {} stopped'.format(pid), outs)
         self.assertIn('Reproducer written', outs)
 
@@ -63,7 +64,8 @@ def test_create_after_attach_with_fork(self):
             stdin=subprocess.PIPE,
             stdout=subprocess.PIPE,
             stderr=subprocess.PIPE)
-        outs, errs = replay.communicate()
+        outs, _ = replay.communicate()
+        outs = outs.decode('utf-8')
         self.assertIn('Process {} stopped'.format(pid), outs)
 
         # We can dump the reproducer in the current context.


        


More information about the lldb-commits mailing list