本文整理匯總了Python中nose.config.Config.getParser方法的典型用法代碼示例。如果您正苦於以下問題:Python Config.getParser方法的具體用法?Python Config.getParser怎麽用?Python Config.getParser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nose.config.Config
的用法示例。
在下文中一共展示了Config.getParser方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: autohelp_directive
# 需要導入模塊: from nose.config import Config [as 別名]
# 或者: from nose.config.Config import getParser [as 別名]
def autohelp_directive(dirname, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
"""produces rst from nose help"""
config = Config(parserClass=OptBucket,
plugins=BuiltinPluginManager())
parser = config.getParser(TestProgram.usage())
rst = ViewList()
for line in parser.format_help().split('\n'):
rst.append(line, '<autodoc>')
rst.append('Options', '<autodoc>')
rst.append('-------', '<autodoc>')
rst.append('', '<autodoc>')
for opt in parser:
rst.append(opt.options(), '<autodoc>')
rst.append(' \n', '<autodoc>')
rst.append(' ' + opt.help + '\n', '<autodoc>')
rst.append('\n', '<autodoc>')
node = nodes.section()
node.document = state.document
surrounding_title_styles = state.memo.title_styles
surrounding_section_level = state.memo.section_level
state.memo.title_styles = []
state.memo.section_level = 0
state.nested_parse(rst, 0, node, match_titles=1)
state.memo.title_styles = surrounding_title_styles
state.memo.section_level = surrounding_section_level
return node.children
示例2: nose_has_option
# 需要導入模塊: from nose.config import Config [as 別名]
# 或者: from nose.config.Config import getParser [as 別名]
def nose_has_option(self, optname):
from nose.config import Config
optname = '--' + optname
nose_config = Config()
parser = nose_config.getParser()
return parser.get_option(optname) is not None