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

Unified Diff: native_client_sdk/src/tools/tests/getos_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 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/tests/fix_deps_test.py ('k') | native_client_sdk/src/tools/tests/httpd_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tools/tests/getos_test.py
diff --git a/native_client_sdk/src/tools/tests/getos_test.py b/native_client_sdk/src/tools/tests/getos_test.py
index f47fffb11ab6d0e9cad46bd3b06c58942c4fe6d6..710ec52febeb2c3096bfffa2adca81d2cb2679f1 100755
--- a/native_client_sdk/src/tools/tests/getos_test.py
+++ b/native_client_sdk/src/tools/tests/getos_test.py
@@ -12,7 +12,7 @@ import unittest
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
TOOLS_DIR = os.path.dirname(SCRIPT_DIR)
CHROME_SRC = os.path.dirname(os.path.dirname(os.path.dirname(TOOLS_DIR)))
-MOCK_DIR = os.path.join(CHROME_SRC, "third_party", "pymock")
+MOCK_DIR = os.path.join(CHROME_SRC, 'third_party', 'pymock')
# For the mock library
sys.path.append(MOCK_DIR)
@@ -103,6 +103,24 @@ class TestGetos(TestCaseExtended):
arch = getos.GetNaClArch(platform)
self.assertIn(arch, ('x86_64', 'x86_32', 'arm'))
+ def testMainInvalidArgs(self):
+ with self.assertRaises(SystemExit):
+ with mock.patch('sys.stderr'):
+ getos.main('--foo')
+
+ @mock.patch('sys.stdout', mock.Mock())
+ @mock.patch('getos.GetPlatform')
+ def testMainNoArgs(self, mock_get_platform):
+ mock_get_platform.return_value = 'platform'
+ getos.main([])
+
+ @mock.patch('sys.stdout', mock.Mock())
+ @mock.patch('getos.GetSystemArch')
+ def testMainArgsParsing(self, mock_system_arch):
+ mock_system_arch.return_value = 'dummy'
+ getos.main(['--arch'])
+ mock_system_arch.assert_called()
+
class TestGetosWithTempdir(TestCaseExtended):
def setUp(self):
« no previous file with comments | « native_client_sdk/src/tools/tests/fix_deps_test.py ('k') | native_client_sdk/src/tools/tests/httpd_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698