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

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

Issue 720233003: [NaCl SDK] Convert python scripts from optparse to argparse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
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..1667c694ee032db8c5375df21057a468dd5119f4 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,
@@ -66,18 +68,20 @@ class TestDefaultLibpath(unittest.TestCase):
In the absence of NACL_SDK_ROOT GetDefaultLibPath should
return the empty list."""
- with mock.patch.dict('os.environ', clear=True):
+ with patch.dict('os.environ', clear=True):
paths = create_nmf.GetDefaultLibPath('Debug')
self.assertEqual(paths, [])
+ @patch('create_nmf.IsValidSDKRoot', Mock(return_value=True))
binji 2014/11/13 23:57:05 seems unrelated
Sam Clegg 2014/11/30 17:55:14 Done.
def testHonorNaClSDKRoot(self):
- with mock.patch.dict('os.environ', {'NACL_SDK_ROOT': '/dummy/path'}):
+ with patch.dict('os.environ', {'NACL_SDK_ROOT': '/dummy/path'}):
paths = create_nmf.GetDefaultLibPath('Debug')
for path in paths:
self.assertTrue(path.startswith('/dummy/path'))
+ @patch('create_nmf.IsValidSDKRoot', Mock(return_value=True))
def testIncludesNaClPorts(self):
- with mock.patch.dict('os.environ', {'NACL_SDK_ROOT': '/dummy/path'}):
+ with patch.dict('os.environ', {'NACL_SDK_ROOT': '/dummy/path'}):
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))

Powered by Google App Engine
This is Rietveld 408576698