diff --git a/oauth2client/tools.py b/oauth2client/tools.py index ac89d82..1f93173 100644 --- a/oauth2client/tools.py +++ b/oauth2client/tools.py @@ -47,28 +47,27 @@ with information from the APIs Console . """ -# argparser is an ArgumentParser that contains command-line options expected -# by tools.run(). Pass it in as part of the 'parents' argument to your own -# ArgumentParser. -argparser = _CreateArgumentParser() - def _CreateArgumentParser(): try: import argparse except ImportError: return None - argparser = argparse.ArgumentParser(add_help=False) - argparser.add_argument('--auth_host_name', default='localhost', - help='Hostname when running a local web server.') - argparser.add_argument('--noauth_local_webserver', action='store_true', - default=False, help='Do not run a local web server.') - argparser.add_argument('--auth_host_port', default=[8080, 8090], type=int, - nargs='*', help='Port web server should listen on.') - argparser.add_argument('--logging_level', default='ERROR', - choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', - 'CRITICAL'], - help='Set the logging level of detail.') - return argparser + parser = argparse.ArgumentParser(add_help=False) + parser.add_argument('--auth_host_name', default='localhost', + help='Hostname when running a local web server.') + parser.add_argument('--noauth_local_webserver', action='store_true', + default=False, help='Do not run a local web server.') + parser.add_argument('--auth_host_port', default=[8080, 8090], type=int, + nargs='*', help='Port web server should listen on.') + parser.add_argument('--logging_level', default='ERROR', + choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], + help='Set the logging level of detail.') + return parser + +# argparser is an ArgumentParser that contains command-line options expected +# by tools.run(). Pass it in as part of the 'parents' argument to your own +# ArgumentParser. +argparser = _CreateArgumentParser() class ClientRedirectServer(BaseHTTPServer.HTTPServer): diff --git a/tests/test_import.py b/tests/test_import.py new file mode 100644 index 0000000..9d9e071 --- /dev/null +++ b/tests/test_import.py @@ -0,0 +1,27 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Test we can import modules in this package.""" + +import unittest + + +class ImportTest(unittest.TestCase): + + def test_tools_import(self): + import oauth2client.tools + + +if __name__ == '__main__': + unittest.main()