1"""Check that we handle an ImportError in a special way when command script importing files.""" 2 3 4import lldb 5from lldbsuite.test.decorators import * 6from lldbsuite.test.lldbtest import * 7from lldbsuite.test import lldbutil 8 9 10class Rdar12586188TestCase(TestBase): 11 @add_test_categories(["pyapi"]) 12 @no_debug_info_test 13 def test_rdar12586188_command(self): 14 """Check that we handle an ImportError in a special way when command script importing files.""" 15 self.run_test() 16 17 def run_test(self): 18 """Check that we handle an ImportError in a special way when command script importing files.""" 19 20 self.expect( 21 "command script import ./fail12586188.py --allow-reload", 22 error=True, 23 substrs=['raise ImportError("I do not want to be imported")'], 24 ) 25 self.expect( 26 "command script import ./fail212586188.py --allow-reload", 27 error=True, 28 substrs=['raise ValueError("I do not want to be imported")'], 29 ) 30