Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Unified Diff: native_client_sdk/src/tools/tests/create_nmf_test.py

Issue 737653003: [NaCl SDK] Remove create_nmf dependency on NACL_SDK_ROOT env var (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « native_client_sdk/src/tools/create_nmf.py ('k') | ppapi/ppapi_nacl.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tools/tests/create_nmf_test.py
diff --git a/native_client_sdk/src/tools/tests/create_nmf_test.py b/native_client_sdk/src/tools/tests/create_nmf_test.py
index 86a89a2e272bdbb8dbc032fe7ef9b31d653de68c..d71bee965623d2647e3ef512ca3bd340eafc27bc 100755
--- a/native_client_sdk/src/tools/tests/create_nmf_test.py
+++ b/native_client_sdk/src/tools/tests/create_nmf_test.py
@@ -14,17 +14,19 @@ import unittest
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
TOOLS_DIR = os.path.dirname(SCRIPT_DIR)
DATA_DIR = os.path.join(TOOLS_DIR, 'lib', 'tests', 'data')
+BUILD_TOOLS_DIR = os.path.join(os.path.dirname(TOOLS_DIR), 'build_tools')
CHROME_SRC = os.path.dirname(os.path.dirname(os.path.dirname(TOOLS_DIR)))
MOCK_DIR = os.path.join(CHROME_SRC, 'third_party', 'pymock')
# For the mock library
sys.path.append(MOCK_DIR)
sys.path.append(TOOLS_DIR)
+sys.path.append(BUILD_TOOLS_DIR)
import build_paths
import create_nmf
import getos
-import mock
+from mock import patch, Mock
TOOLCHAIN_OUT = os.path.join(build_paths.OUT_DIR, 'sdk_tests', 'toolchain')
NACL_X86_GLIBC_TOOLCHAIN = os.path.join(TOOLCHAIN_OUT,
@@ -61,24 +63,18 @@ class TestPosixRelPath(unittest.TestCase):
class TestDefaultLibpath(unittest.TestCase):
- def testWithoutNaClSDKRoot(self):
- """GetDefaultLibPath wihtout NACL_SDK_ROOT set
-
- In the absence of NACL_SDK_ROOT GetDefaultLibPath should
- return the empty list."""
- with mock.patch.dict('os.environ', clear=True):
- paths = create_nmf.GetDefaultLibPath('Debug')
- self.assertEqual(paths, [])
-
- def testHonorNaClSDKRoot(self):
- with mock.patch.dict('os.environ', {'NACL_SDK_ROOT': '/dummy/path'}):
- paths = create_nmf.GetDefaultLibPath('Debug')
+ def setUp(self):
+ patcher = patch('create_nmf.GetSDKRoot', Mock(return_value='/dummy/path'))
+ patcher.start()
+ self.addCleanup(patcher.stop)
+
+ def testUsesSDKRoot(self):
+ paths = create_nmf.GetDefaultLibPath('Debug')
for path in paths:
self.assertTrue(path.startswith('/dummy/path'))
def testIncludesNaClPorts(self):
- with mock.patch.dict('os.environ', {'NACL_SDK_ROOT': '/dummy/path'}):
- paths = create_nmf.GetDefaultLibPath('Debug')
+ paths = create_nmf.GetDefaultLibPath('Debug')
self.assertTrue(any(os.path.join('ports', 'lib') in p for p in paths),
"naclports libpath missing: %s" % str(paths))
« no previous file with comments | « native_client_sdk/src/tools/create_nmf.py ('k') | ppapi/ppapi_nacl.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698