def _init_options(self, kwargs):
     super(ListChanges, self)._init_options(kwargs)
     self.options["include"] = process_list_arg(self.options.get("include", []))
     self.options["exclude"] = process_list_arg(self.options.get("exclude", []))
     self.options["snapshot"] = process_bool_arg(self.options.get("snapshot", []))
     self._exclude = self.options.get("exclude", [])
     self._exclude.extend(self.project_config.project__source__ignore or [])
     self._load_maxrevision()
Exemple #2
0
    def _init_options(self, kwargs):
        super()._init_options(kwargs)

        self.api_names = {
            self._inject_namespace(arg)
            for arg in process_list_arg(self.options.get("api_names", ["*"]))
        }
        self.api_names = {
            quote(arg, safe=" ") if arg != "*" else arg
            for arg in self.api_names
        }
    def _init_options(self, kwargs):
        super(Robot, self)._init_options(kwargs)

        if "tests" in self.options:
            self.options["tests"] = process_list_arg(self.options["tests"])

        if "include" in self.options:
            self.options["include"] = process_list_arg(self.options["include"])

        if "exclude" in self.options:
            self.options["exclude"] = process_list_arg(self.options["exclude"])

        if "vars" in self.options:
            self.options["vars"] = process_list_arg(self.options["vars"])
        else:
            self.options["vars"] = []
        self.options["vars"].append("org:{}".format(self.org_config.name))

        # Initialize options as a dict
        if "options" not in self.options:
            self.options["options"] = {}
Exemple #4
0
    def _init_options(self, kwargs):
        super(RunApexTests, self)._init_options(kwargs)

        self.options["test_name_match"] = self.options.get(
            "test_name_match", self.project_config.project__test__name_match)

        self.options["test_name_exclude"] = self.options.get(
            "test_name_exclude",
            self.project_config.project__test__name_exclude)

        if self.options["test_name_exclude"] is None:
            self.options["test_name_exclude"] = ""

        self.options["namespace"] = self.options.get(
            "namespace", self.project_config.project__package__namespace)

        self.options["junit_output"] = self.options.get(
            "junit_output", "test_results.xml")

        self.options["json_output"] = self.options.get("json_output",
                                                       "test_results.json")

        self.options["managed"] = process_bool_arg(
            self.options.get("managed", False))

        self.options["retry_failures"] = process_list_arg(
            self.options.get("retry_failures", []))
        compiled_res = []
        for regex in self.options["retry_failures"]:
            try:
                compiled_res.append(re.compile(regex))
            except re.error as e:
                raise TaskOptionsError(
                    "An invalid regular expression ({}) was provided ({})".
                    format(regex, e))
        self.options["retry_failures"] = compiled_res
        self.options["retry_always"] = process_bool_arg(
            self.options.get("retry_always", False))
        self.verbose = process_bool_arg(self.options.get("verbose", False))

        self.counts = {}

        if "required_org_code_coverage_percent" in self.options:
            try:
                self.code_coverage_level = int(
                    str(self.options["required_org_code_coverage_percent"]).
                    rstrip("%"))
            except ValueError:
                raise TaskOptionsError(
                    f"Invalid code coverage level {self.options['required_org_code_coverage_percent']}"
                )
        else:
            self.code_coverage_level = None
Exemple #5
0
    def _init_options(self, kwargs):
        super(Robot, self)._init_options(kwargs)

        if 'tests' in self.options:
            self.options['tests'] = process_list_arg(self.options['tests'])

        if 'include' in self.options:
            self.options['include'] = process_list_arg(self.options['include'])

        if 'exclude' in self.options:
            self.options['exclude'] = process_list_arg(self.options['exclude'])

        if 'vars' in self.options:
            self.options['vars'] = process_list_arg(self.options['vars'])
        else:
            self.options['vars'] = []
        self.options['vars'].append('org:{}'.format(self.org_config.name))

        # Initialize options as a dict
        if 'options' not in self.options:
            self.options['options'] = {}
Exemple #6
0
    def _init_options(self, kwargs):
        super(Robot, self)._init_options(kwargs)

        for option in ("test", "include", "exclude", "vars"):
            if option in self.options:
                self.options[option] = process_list_arg(self.options[option])
        if "vars" not in self.options:
            self.options["vars"] = []

        # Initialize options as a dict
        if "options" not in self.options:
            self.options["options"] = {}

        # processes needs to be an integer.
        try:
            self.options["processes"] = int(self.options.get("processes", 1))
        except (TypeError, ValueError):
            raise TaskOptionsError(
                "Please specify an integer for the `processes` option."
            )

        # There are potentially many robot options that are or could
        # be lists, but the only one we currently care about is the
        # listener option since we may need to append additional values
        # onto it.
        for option in ("listener",):
            if option in self.options["options"]:
                self.options["options"][option] = process_list_arg(
                    self.options["options"][option]
                )

        listeners = self.options["options"].setdefault("listener", [])
        if process_bool_arg(self.options.get("verbose")):
            listeners.append(KeywordLogger())

        if process_bool_arg(self.options.get("debug")):
            listeners.append(DebugListener())

        if process_bool_arg(self.options.get("pdb")):
            patch_statusreporter()
Exemple #7
0
    def _init_options(self, kwargs):
        super(DeleteData, self)._init_options(kwargs)

        # Split and trim objects string into a list if not already a list
        self.options["objects"] = process_list_arg(self.options["objects"])
        if not len(self.options["objects"]) or not self.options["objects"][0]:
            raise TaskOptionsError("At least one object must be specified.")

        self.options["where"] = self.options.get("where", None)
        if len(self.options["objects"]) > 1 and self.options["where"]:
            raise TaskOptionsError(
                "Criteria cannot be specified if more than one object is specified."
            )
        self.options["hardDelete"] = process_bool_arg(self.options.get("hardDelete"))
    def _init_options(self, kwargs):
        super(Robot, self)._init_options(kwargs)

        for option in ("test", "include", "exclude", "vars"):
            if option in self.options:
                self.options[option] = process_list_arg(self.options[option])
        if "vars" not in self.options:
            self.options["vars"] = []

        # Initialize options as a dict
        if "options" not in self.options:
            self.options["options"] = {}

        if process_bool_arg(self.options.get("verbose")):
            self.options["options"]["listener"] = KeywordLogger

        if process_bool_arg(self.options.get("pdb")):
            patch_statusreporter()
    def _run_task(self):
        sobject = self.options["sobject"]
        describe_results = getattr(self.sf, sobject).describe()
        record_types = [
            rt for rt in describe_results["recordTypeInfos"]
            if not rt["master"]
        ]

        if "ignored_record_types" in self.options:
            ignored_names = process_list_arg(
                self.options["ignored_record_types"])
            record_types = [
                rt for rt in record_types
                if rt["developerName"] not in ignored_names
            ]

        recordtypes_exist = len(record_types) > 0
        return recordtypes_exist
    def _validate_options(self):
        super(RobotLibDoc, self)._validate_options()

        self.options["path"] = process_list_arg(self.options["path"])

        bad_files = []
        for input_file in self.options["path"]:
            if not os.path.exists(input_file):
                bad_files.append(input_file)

        if bad_files:
            if len(bad_files) == 1:
                error_message = "Unable to find the input file '{}'".format(
                    bad_files[0]
                )
            else:
                files = ", ".join(["'{}'".format(filename) for filename in bad_files])
                error_message = "Unable to find the following input files: {}".format(
                    files
                )
            raise TaskOptionsError(error_message)
 def _init_options(self, kwargs):
     super(ReportPushFailures, self)._init_options(kwargs)
     self.options["result_file"] = self.options.get("result_file", "push_fails.csv")
     self.options["ignore_errors"] = process_list_arg(
         self.options.get("ignore_errors", "")
     )
Exemple #12
0
    def _init_options(self, kwargs):
        super()._init_options(kwargs)

        self.options["user_permissions"] = process_list_arg(
            self.options["user_permissions"])