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

Unified Diff: native_client_sdk/src/tools/tests/httpd_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/tools/tests/httpd_test.py
diff --git a/native_client_sdk/src/tools/tests/httpd_test.py b/native_client_sdk/src/tools/tests/httpd_test.py
index ff4ef5add215f290989d17f6f00f128cb2e7bb45..abc1cc3e7ef51b91fe5f91a76746680813d64d3f 100755
--- a/native_client_sdk/src/tools/tests/httpd_test.py
+++ b/native_client_sdk/src/tools/tests/httpd_test.py
@@ -14,13 +14,13 @@ import urllib2
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')
sys.path.append(TOOLS_DIR)
sys.path.append(MOCK_DIR)
import httpd
-from mock import patch
+from mock import patch, Mock
class HTTPDTest(unittest.TestCase):
@@ -38,6 +38,16 @@ class HTTPDTest(unittest.TestCase):
self.assertFalse(self.server.process.is_alive())
+class MainTest(unittest.TestCase):
+ @patch('httpd.LocalHTTPServer')
+ @patch('sys.stdout', Mock())
+ def testArgs(self, mock_server_ctor):
+ mock_server = Mock()
+ mock_server_ctor.return_value = mock_server
+ httpd.main(['-p', '123', '-C', 'dummy'])
+ mock_server_ctor.assert_called_once_with('dummy', 123)
+
+
class RunTest(unittest.TestCase):
def setUp(self):
self.process = None
« no previous file with comments | « native_client_sdk/src/tools/tests/getos_test.py ('k') | native_client_sdk/src/tools/tests/nacl_config_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698