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

Unified Diff: native_client_sdk/src/build_tools/tests/easy_template_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/easy_template_test.py
diff --git a/native_client_sdk/src/build_tools/tests/easy_template_test.py b/native_client_sdk/src/build_tools/tests/easy_template_test.py
index 56017045c80fca8c6728359def3fadf8b4c94b9b..f26de77a1e44ead0737fbc578ee00e6166584ac6 100755
--- a/native_client_sdk/src/build_tools/tests/easy_template_test.py
+++ b/native_client_sdk/src/build_tools/tests/easy_template_test.py
@@ -10,10 +10,18 @@ import sys
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')
BUILD_TOOLS_DIR = os.path.dirname(SCRIPT_DIR)
sys.path.append(BUILD_TOOLS_DIR)
+sys.path.append(MOCK_DIR)
+
import easy_template
+import mock
+
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
class EasyTemplateTestCase(unittest.TestCase):
def _RunTest(self, template, expected, template_dict):
@@ -116,6 +124,12 @@ struct Foo {
self._RunTest('inside {{8 % 3}}', 'inside 2', {})
self._RunTest('Everywhere % {{8 % 3}} %', 'Everywhere % 2 %', {})
+ @mock.patch('easy_template.TemplateToPython')
+ @mock.patch('sys.stdout', mock.Mock())
+ def testMainArgParsing(self, mock_template_to_python):
+ easy_template.main([__file__])
+ mock_template_to_python.assert_called()
+
if __name__ == '__main__':
unittest.main()

Powered by Google App Engine
This is Rietveld 408576698