def test_00_get_options_from_conf(tmpdir): path = os.path.join(str(tmpdir), 'tomahawk.conf') conf = open(path, 'w') try: conf.write(""" [tomahawk] options = --verify-output """.strip()) finally: conf.close() conf_options = get_options_from_conf('tomahawk', path) assert conf_options == ['--verify-output']
def test_00_get_options_from_conf(tmpdir): path = os.path.join(str(tmpdir), 'tomahawk.conf') conf = open(path, 'w') try: conf.write(""" [tomahawk] options = --verify-output """.strip()) finally: conf.close() conf_options = get_options_from_conf('tomahawk', path) assert conf_options == [ '--verify-output' ]
def __init__(self, script_path): self.script_path = script_path self.arg_parser = self.create_argument_parser(script_path) self.options = self.arg_parser.parse_args(sys.argv[1:]) conf_options = None if self.options.conf: conf_options = get_options_from_conf( os.path.basename(script_path), self.options.conf ) args = conf_options + sys.argv[1:] # Re-parse command line options because conf_options added self.options = self.arg_parser.parse_args(args) self.log = create_logger( None, self.options.debug or self.options.deep_debug, self.options.deep_debug ) if conf_options: self.log.debug("Applying options %s from %s" % (str(conf_options), self.options.conf))
def __init__(self, script_path): self.script_path = script_path self.arg_parser = self.create_argument_parser(script_path) self.options = self.arg_parser.parse_args(sys.argv[1:]) conf_options = None if self.options.conf: conf_options = get_options_from_conf( os.path.basename(script_path), self.options.conf ) args = conf_options + sys.argv[1:] # Re-parse command line options because conf_options added self.options = self.arg_parser.parse_args(args) self.log = create_logger( None, self.options.debug or self.options.deep_debug, self.options.deep_debug ) if conf_options: self.log.debug("Applying options %s from %s" % (str(conf_options), self.options.conf))