def start(self): """ Start to parsing arguments. At the end of this method, the support for subparsers is activated. Side effect: update attribute `args` (the namespace). """ self.args, _ = self.application.parse_known_args() # Load settings from file, if user provides one if self.args.config is not None: settings.process_config_path(self.args.config) # Use parent parsing to avoid breaking the output of --help option self.application = ArgumentParser(prog=PROG, description=DESCRIPTION, parents=[self.application]) # Subparsers where Avocado subcommands are plugged self.subcommands = self.application.add_subparsers( title="subcommands", description="valid subcommands", help="subcommand help", dest="subcommand", ) # On Python 2, required doesn't make a difference because a # subparser is considered an unconsumed positional arguments, # and not providing one will error with a "too few arguments" # message. On Python 3, required arguments are used instead. # Unfortunately, there's no way to pass this as an option when # constructing the sub parsers, but it is possible to set that # option afterwards. self.subcommands.required = True
def load_config(self, resultsdir): config = jobdata.retrieve_config(resultsdir) if config is not None: settings.process_config_path(config)
def load_config(self, resultsdir): config = os.path.join(resultsdir, 'replay', 'config') with open(config, 'r') as f: settings.process_config_path(f.read())
def load_config(self, resultsdir): config = os.path.join(resultsdir, "replay", "config") with open(config, "r") as f: settings.process_config_path(f.read())