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

Unified Diff: native_client_sdk/src/build_tools/tests/test_projects_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
Index: native_client_sdk/src/build_tools/tests/test_projects_test.py
diff --git a/native_client_sdk/src/build_tools/tests/test_projects_test.py b/native_client_sdk/src/build_tools/tests/test_projects_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..ca615a81d65688b249d2db7476f5589426250c5f
--- /dev/null
+++ b/native_client_sdk/src/build_tools/tests/test_projects_test.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import sys
+import unittest
+
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+BUILD_TOOLS_DIR = os.path.dirname(SCRIPT_DIR)
+CHROME_SRC = os.path.dirname(os.path.dirname(os.path.dirname(BUILD_TOOLS_DIR)))
+MOCK_DIR = os.path.join(CHROME_SRC, 'third_party', 'pymock')
+
+sys.path.append(BUILD_TOOLS_DIR)
+sys.path.append(MOCK_DIR)
+
+import mock
+import test_projects
+
+class TestMain(unittest.TestCase):
+ """Tests for main() entry point of the script."""
+
+ def testInvalidArgs(self):
+ with mock.patch('sys.stderr'):
+ with self.assertRaises(SystemExit):
+ test_projects.main(['--foo'])
+
+
+if __name__ == '__main__':
+ unittest.main()

Powered by Google App Engine
This is Rietveld 408576698