tests/functional/configuration/test_all_options.py
def check_cmd_args_config(self, tmp_path, conf_file, monkeypatch):
        """Check that cmdargs configuration overrides global/envvars/local configuration"""
        name = "cmd-test"
        command = (
            f"hunt --worker-max-trials 0 -c {conf_file} -n {name} "
            "--auto-resolution "
            "--non-monitored-arguments test:cmdargs "
            "--code-change-type noeffect "
            "--cli-change-type unsure "
            "--config-change-type break "
            f"python {script} -x~uniform(0,1)"
        )
        assert orion.core.cli.main(command.split(" ")) == 0

        command = self._check_cli_change(
            name, command, version=1, change_type=self.cmdargs["cli-change-type"]
        )
        command = self._check_non_monitored_arguments(
            name,
            command,
            version=2,
            non_monitored_arguments=self.cmdargs["non-monitored-arguments"].split(":"),
        )

        self._check_script_config_change(
            tmp_path,
            name,
            command,
            version=2,
            change_type=self.cmdargs["config-change-type"],
        )

        # Mock local to ignore_code_changes=False
        fetch_config = orion.core.io.resolve_config.fetch_config

        def mock_local(cmdargs):
            config = fetch_config(cmdargs)
            config["evc"]["ignore_code_changes"] = False
            return config

        monkeypatch.setattr(orion.core.io.resolve_config, "fetch_config", mock_local)

        # Check that ignore_code_changes is rightly False
        self._check_code_change(
            monkeypatch,
            name,
            command,
            version=3,
            mock_ignore_code_changes=False,
            ignore_code_changes=False,
            change_type=self.cmdargs["code-change-type"],
        )

        command = "hunt --ignore-code-changes " + command[5:]

        # Check that ignore_code_changes is now True
        self._check_code_change(
            monkeypatch,
            name,
            command,
            version=4,
            mock_ignore_code_changes=True,
            ignore_code_changes=True,
            change_type=self.cmdargs["code-change-type"],
        )
Check that cmdargs configuration overrides global/envvars/local configuration
Check that cmdargs configuration overrides global/envvars/local configuration
Check that cmdargs configuration overrides global / envvars / local configuration
def check_cmd_args_config(self, tmp_path, conf_file, monkeypatch):
        name = "cmd-test"
        command = (
            f"hunt --worker-max-trials 0 -c {conf_file} -n {name} "
            "--auto-resolution "
            "--non-monitored-arguments test:cmdargs "
            "--code-change-type noeffect "
            "--cli-change-type unsure "
            "--config-change-type break "
            f"python {script} -x~uniform(0,1)"
        )
        assert orion.core.cli.main(command.split(" ")) == 0
        command = self._check_cli_change(
            name, command, version=1, change_type=self.cmdargs["cli-change-type"]
        )
        command = self._check_non_monitored_arguments(
            name,
            command,
            version=2,
            non_monitored_arguments=self.cmdargs["non-monitored-arguments"].split(":"),
        )
        self._check_script_config_change(
            tmp_path,
            name,
            command,
            version=2,
            change_type=self.cmdargs["config-change-type"],
        )
        fetch_config = orion.core.io.resolve_config.fetch_config
        def mock_local(cmdargs):
            config = fetch_config(cmdargs)
            config["evc"]["ignore_code_changes"] = False
            return config
        monkeypatch.setattr(orion.core.io.resolve_config, "fetch_config", mock_local)
        self._check_code_change(
            monkeypatch,
            name,
            command,
            version=3,
            mock_ignore_code_changes=False,
            ignore_code_changes=False,
            change_type=self.cmdargs["code-change-type"],
        )
        command = "hunt --ignore-code-changes " + command[5:]
        self._check_code_change(
            monkeypatch,
            name,
            command,
            version=4,
            mock_ignore_code_changes=True,
            ignore_code_changes=True,
            change_type=self.cmdargs["code-change-type"],
        )
def check_cmd_args_config ( self , tmp_path , conf_file , monkeypatch ) : name = "cmd-test" command = ( f"hunt --worker-max-trials 0 -c {conf_file} -n {name} " "--auto-resolution " "--non-monitored-arguments test:cmdargs " "--code-change-type noeffect " "--cli-change-type unsure " "--config-change-type break " f"python {script} -x~uniform(0,1)" ) assert orion . core . cli . main ( command . split ( " " ) ) == 0 command = self . _check_cli_change ( name , command , version = 1 , change_type = self . cmdargs [ "cli-change-type" ] ) command = self . _check_non_monitored_arguments ( name , command , version = 2 , non_monitored_arguments = self . cmdargs [ "non-monitored-arguments" ] . split ( ":" ) , ) self . _check_script_config_change ( tmp_path , name , command , version = 2 , change_type = self . cmdargs [ "config-change-type" ] , ) fetch_config = orion . core . io . resolve_config . fetch_config def mock_local ( cmdargs ) : config = fetch_config ( cmdargs ) config [ "evc" ] [ "ignore_code_changes" ] = False return config monkeypatch . setattr ( orion . core . io . resolve_config , "fetch_config" , mock_local ) self . _check_code_change ( monkeypatch , name , command , version = 3 , mock_ignore_code_changes = False , ignore_code_changes = False , change_type = self . cmdargs [ "code-change-type" ] , ) command = "hunt --ignore-code-changes " + command [ 5 : ] self . _check_code_change ( monkeypatch , name , command , version = 4 , mock_ignore_code_changes = True , ignore_code_changes = True , change_type = self . cmdargs [ "code-change-type" ] , )
Check that cmdargs configuration overrides global/envvars/local configuration
Check that cmdargs configuration overrides global / envvars / local configuration
"""Check that cmdargs configuration overrides global/envvars/local configuration""" # Mock local to ignore_code_changes=False # Check that ignore_code_changes is rightly False # Check that ignore_code_changes is now True
self
tmp_path
conf_file
monkeypatch