Skip to content

Commit

Permalink
[lldb][test][NFC] Narrow scope of import pexpect
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rupprecht committed Mar 4, 2024
1 parent b32845c commit 503075e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lldb/test/API/driver/quit_speed/TestQuitWithProcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

import os
import pexpect
import tempfile
import re

Expand Down
5 changes: 1 addition & 4 deletions lldb/test/API/terminal/TestSTTYBeforeAndAfter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit 503075e

Please sign in to comment.