diff options
author | Brett Cannon <brett@python.org> | 2012-02-17 14:37:39 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2012-02-17 14:37:39 (GMT) |
commit | 1f14bebe3c8e13957867c9f0aa55feb9e767cd0a (patch) | |
tree | 4d0533e451ecb8d3b6d851bc0fadde179e9783a6 /Lib | |
parent | ba17fe256eefa958dcdc912dc01dbad3b5e843e2 (diff) | |
download | cpython-1f14bebe3c8e13957867c9f0aa55feb9e767cd0a.zip cpython-1f14bebe3c8e13957867c9f0aa55feb9e767cd0a.tar.gz cpython-1f14bebe3c8e13957867c9f0aa55feb9e767cd0a.tar.bz2 |
Have importlib.test use argparse instead of some hacked up solution.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/importlib/test/__main__.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/importlib/test/__main__.py b/Lib/importlib/test/__main__.py index a1990b1..5515812 100644 --- a/Lib/importlib/test/__main__.py +++ b/Lib/importlib/test/__main__.py @@ -4,19 +4,24 @@ Specifying the ``--builtin`` flag will run tests, where applicable, with builtins.__import__ instead of importlib.__import__. """ +import argparse from importlib.test.import_ import util import os.path from test.support import run_unittest -import sys import unittest def test_main(): + parser = argparse.ArgumentParser(description='Execute the importlib test ' + 'suite') + parser.add_argument('-b', '--builtin', action='store_true', default=False, + help='use builtins.__import__() instead of importlib') + args = parser.parse_args() + if args.builtin: + util.using___import__ = True start_dir = os.path.dirname(__file__) top_dir = os.path.dirname(os.path.dirname(start_dir)) test_loader = unittest.TestLoader() - if '--builtin' in sys.argv: - util.using___import__ = True run_unittest(test_loader.discover(start_dir, top_level_dir=top_dir)) |