本文整理汇总了Python中pyutilib.misc.Options.debug方法的典型用法代码示例。如果您正苦于以下问题:Python Options.debug方法的具体用法?Python Options.debug怎么用?Python Options.debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyutilib.misc.Options
的用法示例。
在下文中一共展示了Options.debug方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from pyutilib.misc import Options [as 别名]
# 或者: from pyutilib.misc.Options import debug [as 别名]
def run(argv, _globals=None):
#
# Set sys.argv to the value specified by the user
#
sys.argv = argv
#
# Create the option parser
#
parser = optparse.OptionParser()
parser.remove_option('-h')
#
parser.add_option('-h','--help',
action='store_true',
dest='help',
default=False,
help='Print command options')
#
parser.add_option('-d','--debug',
action='store_true',
dest='debug',
default=False,
help='Set debugging flag')
#
parser.add_option('-v','--verbose',
action='store_true',
dest='verbose',
default=False,
help='Verbose output')
#
parser.add_option('-q','--quiet',
action='store_true',
dest='quiet',
default=False,
help='Minimal output')
#
parser.add_option('-f','--failfast',
action='store_true',
dest='failfast',
default=False,
help='Stop on first failure')
#
parser.add_option('-c','--catch',
action='store_true',
dest='catch',
default=False,
help='Catch control-C and display results')
#
parser.add_option('-b','--buffer',
action='store_true',
dest='buffer',
default=False,
help='Buffer stdout and stderr durring test runs')
#
parser.add_option('--cat', '--category',
action='append',
dest='categories',
default=[],
help='Define a list of categories that filter the execution of test suites')
#
parser.add_option('--help-suites',
action='store_true',
dest='help_suites',
default=False,
help='Print the test suites that can be executed')
#
parser.add_option('--help-tests',
action='store',
dest='help_tests',
default=None,
help='Print the tests in the specified test suite')
#
parser.add_option('--help-categories',
action='store_true',
dest='help_categories',
default=False,
help='Print the test suite categories that can be specified')
#
# Parse the argument list and print help info if needed
#
_options, args = parser.parse_args(sys.argv)
if _options.help:
parser.print_help()
print("""
Examples:
%s - run all test suites
%s MyTestCase.testSomething - run MyTestCase.testSomething
%s MyTestCase - run all 'test*' test methods
in MyTestCase
""" % (args[0],args[0],args[0]))
return
#
# If no value for _globals is specified, then we use the current context.
#
if _globals is None:
_globals=globals()
#
# Setup and Options object and create test suites from the specified
# configuration files.
#
#.........这里部分代码省略.........