def __init__(self): self.test_chooser = TestChooser() default_ignore_kls = [] if "NOSE_NOY_IGNORE_KLS" in os.environ: default_ignore_kls.extend(os.environ["NOSE_NOY_IGNORE_KLS"].split(",")) self.ignore_kls = self.config.as_list('ignore-kls', default=default_ignore_kls) self.always_on = self.config.as_bool('always-on', default=False) parser_options = ['default', 'action', 'dest', 'help'] for option, attributes in spec_options.items(): action = attributes.get("action", "store") default = attributes.get("default") if action == "store_true": action = "as_bool" default = False elif action == "store_false": action = "as_bool" default = True elif action == "append": action = "as_list" default = attributes.get("default", []) elif action == "store": action = "as_str" default = attributes.get("default") if callable(default): default = default(os.environ) setattr(self, option.replace("-", "_"), getattr(self.config, action)(option, default=Default(default)))
def run(self): # Create bullet list bullet = nodes.bullet_list() # Determine what to put in the list # sort items alphabetically and by length items = [(name, options['help']) for name, options in spec_options.items()] items.sort() items.sort(cmp=lambda a, b: len(a[0]) - len(b[0])) # Put items in the list for name, options in items: item = nodes.emphasis() item += nodes.Text(name) item += nodes.Text(": %s" % options) list_item = nodes.list_item() list_item += item bullet.append(list_item) return [bullet]