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

Unified Diff: native_client_sdk/src/tools/lib/tests/quote_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/lib/tests/quote_test.py
diff --git a/native_client_sdk/src/tools/lib/tests/quote_test.py b/native_client_sdk/src/tools/lib/tests/quote_test.py
index fe0e6c36059956dcf253367f0acc97882541c2f4..111cc89c20cc22ea6256aec8cd0aad4d1d5c7985 100755
--- a/native_client_sdk/src/tools/lib/tests/quote_test.py
+++ b/native_client_sdk/src/tools/lib/tests/quote_test.py
@@ -3,7 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import optparse
+import argparse
import os
import sys
import unittest
@@ -92,24 +92,25 @@ class TestQuote(unittest.TestCase):
# Invoke this file directly for simple manual testing. For running
# the unittests, use the -t flag. Any flags to be passed to the
-# unittest module should be passed as after the optparse processing,
+# unittest module should be passed as after the argparse processing,
# e.g., "quote_test.py -t -- -v" to pass the -v flag to the unittest
# module.
def main(argv):
global verbose
- parser = optparse.OptionParser(
+ parser = argparse.ArgumentParser(
usage='Usage: %prog [options] word...')
- parser.add_option('-s', '--special-chars', dest='special_chars', default=':',
- help='Special characters to quote (default is ":")')
- parser.add_option('-q', '--quote', dest='quote', default='\\',
- help='Quote or escape character (default is "\")')
- parser.add_option('-t', '--run-tests', dest='tests', action='store_true',
- help='Run built-in tests\n')
- parser.add_option('-u', '--unquote-input', dest='unquote_input',
- action='store_true', help='Unquote command line argument')
- parser.add_option('-v', '--verbose', dest='verbose', action='store_true',
- help='Verbose test output')
+ parser.add_argument('-s', '--special-chars',
+ dest='special_chars', default=':',
+ help='Special characters to quote (default is ":")')
+ parser.add_argument('-q', '--quote', dest='quote', default='\\',
+ help='Quote or escape character (default is "\")')
+ parser.add_argument('-t', '--run-tests', dest='tests', action='store_true',
+ help='Run built-in tests\n')
+ parser.add_argument('-u', '--unquote-input', dest='unquote_input',
+ action='store_true', help='Unquote command line argument')
+ parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
+ help='Verbose test output')
options, args = parser.parse_args(argv)
binji 2014/11/13 23:57:04 fix
if options.verbose:

Powered by Google App Engine
This is Rietveld 408576698