summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/lang/objc/foundation
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-11-03 02:06:18 +0000
committerZachary Turner <zturner@google.com>2015-11-03 02:06:18 +0000
commit95c453a221d5e757830145c2d5198c3a9da3f4b2 (patch)
treeaa824a74049518ed35ff67e2182f2dfcceac0658 /lldb/packages/Python/lldbsuite/test/lang/objc/foundation
parent6f4ed269b9f4d8296f2002f5d96fcc5d8a9ef7b1 (diff)
downloadbcm5719-llvm-95c453a221d5e757830145c2d5198c3a9da3f4b2.tar.gz
bcm5719-llvm-95c453a221d5e757830145c2d5198c3a9da3f4b2.zip
Tighten up sys.path, and use absolute imports everywhere.
For convenience, we had added the folder that dotest.py was in to sys.path, so that we could easily write things like `import lldbutil` from anywhere and any test. This introduces a subtle problem when using Python's package system, because when unittest2 imports a particular test suite, the test suite is detached from the package. Thus, writing "import lldbutil" from dotest imports it as part of the package, and writing the same line from a test does a fresh import since the importing module was not part of the same package. The real way to fix this is to use absolute imports everywhere. Instead of writing "import lldbutil", we need to write "import lldbsuite.test.util". This patch fixes up that and all other similar cases, and additionally removes the script directory from sys.path to ensure that this can't happen again. llvm-svn: 251886
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lang/objc/foundation')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py6
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py5
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestRuntimeTypes.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestSymbolTable.py2
7 files changed, 15 insertions, 14 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py
index 67c643a50e7..40d640f2e94 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py
@@ -9,8 +9,8 @@ import use_lldb_suite
import os, time
import lldb
-from lldbtest import *
-import lldbutil
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
class ConstStringTestCase(TestBase):
diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py
index 4ad2698cc38..55031cd58a2 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py
@@ -9,8 +9,8 @@ import use_lldb_suite
import unittest2
import os, time
import lldb
-from lldbtest import *
-import lldbutil
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
@skipUnlessDarwin
class FoundationDisassembleTestCase(TestBase):
diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py
index 2bf5b7f772b..ae9776af7da 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py
@@ -10,8 +10,8 @@ import use_lldb_suite
import os, os.path, time
import lldb
import string
-from lldbtest import *
-import lldbutil
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
file_index = 0
@skipUnlessDarwin
@@ -195,7 +195,7 @@ class FoundationTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
thread = process.GetThreadAtIndex(0)
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
- from lldbutil import stop_reason_to_str
+ from lldbsuite.test.lldbutil import stop_reason_to_str
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
stop_reason_to_str(thread.GetStopReason()))
diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py
index ffa0d673afc..40ba89bd03b 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py
@@ -8,8 +8,8 @@ import use_lldb_suite
import os, time
import lldb
-from lldbtest import *
-import lldbutil
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
@skipUnlessDarwin
class FoundationTestCase2(TestBase):
diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py
index 85b08592ed7..d50f5d62847 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py
@@ -8,8 +8,9 @@ import use_lldb_suite
import os, time
import re
-import lldb, lldbutil
-from lldbtest import *
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
class ObjectDescriptionAPITestCase(TestBase):
diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestRuntimeTypes.py b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestRuntimeTypes.py
index d04660d4360..da110bd07f3 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestRuntimeTypes.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestRuntimeTypes.py
@@ -8,8 +8,8 @@ import use_lldb_suite
import os, time
import lldb
-from lldbtest import *
-import lldbutil
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
@skipUnlessDarwin
class RuntimeTypesTestCase(TestBase):
diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestSymbolTable.py b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestSymbolTable.py
index 0e2c5ed21b0..cb947b5055b 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestSymbolTable.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestSymbolTable.py
@@ -8,7 +8,7 @@ import use_lldb_suite
import os, time
import lldb
-from lldbtest import *
+from lldbsuite.test.lldbtest import *
@skipUnlessDarwin
class FoundationSymtabTestCase(TestBase):
OpenPOWER on IntegriCloud