1"""Check that we handle an ImportError in a special way when command script importing files."""
2
3import os, sys, time
4import unittest2
5import lldb
6from lldbtest import *
7
8class Rdar12586188TestCase(TestBase):
9
10    mydir = os.path.join("functionalities", "command_script", "import", "rdar-12586188")
11
12    @python_api_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 setUp(self):
18        # Call super's setUp().
19        TestBase.setUp(self)
20
21    def run_test(self):
22        """Check that we handle an ImportError in a special way when command script importing files."""
23
24        self.expect("command script import ./fail12586188.py --allow-reload",
25                error=True, substrs = ['error: module importing failed: I do not want to be imported'])
26        self.expect("command script import ./fail212586188.py --allow-reload",
27                error=True, substrs = ['error: module importing failed: Python error raised while importing module: I do not want to be imported'])
28
29if __name__ == '__main__':
30    import atexit
31    lldb.SBDebugger.Initialize()
32    atexit.register(lambda: lldb.SBDebugger.Terminate())
33    unittest2.main()
34