[Lldb-commits] [lldb] 503075e - [lldb][test][NFC] Narrow scope of `import pexpect`

Jordan Rupprecht via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 4 11:21:54 PST 2024


Author: Jordan Rupprecht
Date: 2024-03-04T11:21:47-08:00
New Revision: 503075e4d4a9c1b3754b21ee9ec41f176e54fd83

URL: https://github.com/llvm/llvm-project/commit/503075e4d4a9c1b3754b21ee9ec41f176e54fd83
DIFF: https://github.com/llvm/llvm-project/commit/503075e4d4a9c1b3754b21ee9ec41f176e54fd83.diff

LOG: [lldb][test][NFC] Narrow scope of `import pexpect`

We do not run `pexpect` based tests on Windows, but there are still cases where those tests run `import pexpect` outside of the scope where the test is skipped. By moving the import statement to a different scope, those tests can run even when `pexpect` truly isn't installed.

Tangentially related: TestSTTYBeforeAndAfter.py is using a manual `@expectedFailureAll` for windows instead of the common `@skipIfWindows`. If `pexepect` is generally expected to not be available, we should not bother running the test at all.

Added: 
    

Modified: 
    lldb/test/API/driver/quit_speed/TestQuitWithProcess.py
    lldb/test/API/functionalities/progress_reporting/TestTrimmedProgressReporting.py
    lldb/test/API/terminal/TestSTTYBeforeAndAfter.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/driver/quit_speed/TestQuitWithProcess.py b/lldb/test/API/driver/quit_speed/TestQuitWithProcess.py
index 957586d41f6b40..42527c88b99213 100644
--- a/lldb/test/API/driver/quit_speed/TestQuitWithProcess.py
+++ b/lldb/test/API/driver/quit_speed/TestQuitWithProcess.py
@@ -2,12 +2,10 @@
 Test that killing the target while quitting doesn't stall
 """
 
-
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
-import pexpect
 from lldbsuite.test.lldbpexpect import PExpectTest
 
 
@@ -16,6 +14,8 @@ class DriverQuitSpeedTest(PExpectTest):
 
     def test_run_quit(self):
         """Test that the lldb driver's batch mode works correctly."""
+        import pexpect
+
         self.build()
 
         exe = self.getBuildArtifact("a.out")

diff  --git a/lldb/test/API/functionalities/progress_reporting/TestTrimmedProgressReporting.py b/lldb/test/API/functionalities/progress_reporting/TestTrimmedProgressReporting.py
index ee35dbd23b3dbe..3cf7b9d2100891 100644
--- a/lldb/test/API/functionalities/progress_reporting/TestTrimmedProgressReporting.py
+++ b/lldb/test/API/functionalities/progress_reporting/TestTrimmedProgressReporting.py
@@ -3,7 +3,6 @@
 """
 
 import os
-import pexpect
 import tempfile
 import re
 

diff  --git a/lldb/test/API/terminal/TestSTTYBeforeAndAfter.py b/lldb/test/API/terminal/TestSTTYBeforeAndAfter.py
index 31b960859fa2e5..e5663c50c736e6 100644
--- a/lldb/test/API/terminal/TestSTTYBeforeAndAfter.py
+++ b/lldb/test/API/terminal/TestSTTYBeforeAndAfter.py
@@ -19,10 +19,7 @@ def classCleanup(cls):
         cls.RemoveTempFile("child_send2.txt")
         cls.RemoveTempFile("child_read2.txt")
 
-    @expectedFailureAll(
-        hostoslist=["windows"],
-        bugnumber="llvm.org/pr22274: need a pexpect replacement for windows",
-    )
+    @skipIfWindows  # llvm.org/pr22274: need a pexpect replacement for windows
     @no_debug_info_test
     def test_stty_dash_a_before_and_afetr_invoking_lldb_command(self):
         """Test that 'stty -a' displays the same output before and after running the lldb command."""


        


More information about the lldb-commits mailing list