aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/functionalities/command_script/import
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/command_script/import')
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py28
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py17
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py10
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py18
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py9
13 files changed, 66 insertions, 44 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py
index 01c3f35bf300..01e7902b0f32 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py
@@ -3,13 +3,15 @@
from __future__ import print_function
-
-import os, sys, time
+import os
+import sys
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ImportTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -47,29 +49,31 @@ class ImportTestCase(TestBase):
self.runCmd("command script import ./bar/bar.py --allow-reload")
self.expect("command script import ./nosuchfile.py",
- error=True, startstr='error: module importing failed')
+ error=True, startstr='error: module importing failed')
self.expect("command script import ./nosuchfolder/",
- error=True, startstr='error: module importing failed')
+ error=True, startstr='error: module importing failed')
self.expect("command script import ./foo/foo.py", error=False)
self.runCmd("command script import --allow-reload ./thepackage")
- self.expect("TPcommandA",substrs=["hello world A"])
- self.expect("TPcommandB",substrs=["hello world B"])
+ self.expect("TPcommandA", substrs=["hello world A"])
+ self.expect("TPcommandB", substrs=["hello world B"])
self.runCmd("script import dummymodule")
self.expect("command script import ./dummymodule.py", error=False)
- self.expect("command script import --allow-reload ./dummymodule.py", error=False)
+ self.expect(
+ "command script import --allow-reload ./dummymodule.py",
+ error=False)
self.runCmd("command script add -f foo.foo_function foocmd")
self.runCmd("command script add -f foobar.foo_function foobarcmd")
self.runCmd("command script add -f bar.bar_function barcmd")
self.expect("foocmd hello",
- substrs = ['foo says', 'hello'])
+ substrs=['foo says', 'hello'])
self.expect("foo2cmd hello",
- substrs = ['foo2 says', 'hello'])
+ substrs=['foo2 says', 'hello'])
self.expect("barcmd hello",
- substrs = ['barutil says', 'bar told me', 'hello'])
+ substrs=['barutil says', 'bar told me', 'hello'])
self.expect("barothercmd hello",
- substrs = ['barutil says', 'bar told me', 'hello'])
+ substrs=['barutil says', 'bar told me', 'hello'])
self.expect("foobarcmd hello",
- substrs = ['foobar says', 'hello'])
+ substrs=['foobar says', 'hello'])
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py
index bbc41f3b217d..444e00976ad9 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py
@@ -1,12 +1,15 @@
from __future__ import print_function
+
def bar_function(debugger, args, result, dict):
- global UtilityModule
- print(UtilityModule.barutil_function("bar told me " + args), file=result)
- return None
+ global UtilityModule
+ print(UtilityModule.barutil_function("bar told me " + args), file=result)
+ return None
+
def __lldb_init_module(debugger, session_dict):
- global UtilityModule
- UtilityModule = __import__("barutil")
- debugger.HandleCommand("command script add -f bar.bar_function barothercmd")
- return None \ No newline at end of file
+ global UtilityModule
+ UtilityModule = __import__("barutil")
+ debugger.HandleCommand(
+ "command script add -f bar.bar_function barothercmd")
+ return None
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py
index 0d3d2eb1b2d7..70ecea300578 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py
@@ -1,2 +1,2 @@
def barutil_function(x):
- return "barutil says: " + x
+ return "barutil says: " + x
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py
index dcc724ec9c23..668a5b90ea4f 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py
@@ -1,2 +1,2 @@
def no_useful_code(foo):
- return foo
+ return foo
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py
index 659ded22c901..6ef71064c9a9 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py
@@ -1,5 +1,6 @@
from __future__ import print_function
+
def foo_function(debugger, args, result, dict):
- print("foobar says " + args, file=result)
- return None
+ print("foobar says " + args, file=result)
+ return None
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py
index 51cc0c3bab19..1ccc38929396 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py
@@ -1,5 +1,6 @@
from __future__ import print_function
+
def foo_function(debugger, args, result, dict):
- print("foo says " + args, file=result)
- return None
+ print("foo says " + args, file=result)
+ return None
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py
index 6863454ca6ef..71657c299c21 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py
@@ -1,9 +1,11 @@
from __future__ import print_function
+
def foo2_function(debugger, args, result, dict):
- print("foo2 says " + args, file=result)
- return None
+ print("foo2 says " + args, file=result)
+ return None
+
def __lldb_init_module(debugger, session_dict):
- debugger.HandleCommand("command script add -f foo2.foo2_function foo2cmd")
- return None \ No newline at end of file
+ debugger.HandleCommand("command script add -f foo2.foo2_function foo2cmd")
+ return None
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py
index 4f7ebebd4dd2..01fd51385836 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py
@@ -3,13 +3,15 @@
from __future__ import print_function
-
-import os, sys, time
+import os
+import sys
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class Rdar12586188TestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -27,7 +29,11 @@ class Rdar12586188TestCase(TestBase):
def run_test(self):
"""Check that we handle an ImportError in a special way when command script importing files."""
- self.expect("command script import ./fail12586188.py --allow-reload",
- error=True, substrs = ['raise ImportError("I do not want to be imported")'])
- self.expect("command script import ./fail212586188.py --allow-reload",
- error=True, substrs = ['raise ValueError("I do not want to be imported")'])
+ self.expect(
+ "command script import ./fail12586188.py --allow-reload",
+ error=True,
+ substrs=['raise ImportError("I do not want to be imported")'])
+ self.expect(
+ "command script import ./fail212586188.py --allow-reload",
+ error=True,
+ substrs=['raise ValueError("I do not want to be imported")'])
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py
index add85a73f853..ea385e03e046 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py
@@ -1,4 +1,4 @@
def f(x):
- return x + 1
+ return x + 1
raise ImportError("I do not want to be imported")
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py
index 1549a036590f..8dbc0e67ba19 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py
@@ -1,4 +1,4 @@
def f(x):
- return x + 1
+ return x + 1
raise ValueError("I do not want to be imported")
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py
index fb65305d205c..9694b084295f 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py
@@ -1,6 +1,7 @@
import six
+
def command(debugger, command, result, internal_dict):
- result.PutCString(six.u("hello world A"))
- return None
+ result.PutCString(six.u("hello world A"))
+ return None
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py
index 60b31b89f6da..94a333bc696b 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py
@@ -1,6 +1,7 @@
import six
+
def command(debugger, command, result, internal_dict):
- result.PutCString(six.u("hello world B"))
- return None
+ result.PutCString(six.u("hello world B"))
+ return None
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py
index 1181462af868..24cdea60f2c4 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py
@@ -3,6 +3,9 @@ from __future__ import absolute_import
from . import TPunitA
from . import TPunitB
-def __lldb_init_module(debugger,*args):
- debugger.HandleCommand("command script add -f thepackage.TPunitA.command TPcommandA")
- debugger.HandleCommand("command script add -f thepackage.TPunitB.command TPcommandB")
+
+def __lldb_init_module(debugger, *args):
+ debugger.HandleCommand(
+ "command script add -f thepackage.TPunitA.command TPcommandA")
+ debugger.HandleCommand(
+ "command script add -f thepackage.TPunitB.command TPcommandB")