from zaf.config.options import ConfigOptionId from zaf.config.types import Flag from zaf.messages.message import EndpointId ABORT_ON_FAIL_ENABLED = ConfigOptionId('abort.on.fail', 'Enable abort on fail addon', option_type=Flag(), default=False) ABORT_ON_FAIL_ENDPOINT = EndpointId('abortonfailaddon', """ Abort on fail """) ABORT_ON_UNEXPECTED_SUT_RESET_ENDPOINT = EndpointId( 'abortonunexpectedsutreset', """ Abort on unexpected sut reset """) ABORT_ON_UNEXPECTED_SUT_RESET = ConfigOptionId( 'abort.on.unexpected.sut.reset', 'Abort a test run when an unexpected sut reset occurs.', option_type=Flag(), default=False)
MULTIPLE_STR_OPTION = ConfigOption(ConfigOptionId('multiple.str.option', '', multiple=True), required=False) STR_OPTION = ConfigOption(ConfigOptionId('str.option', ''), required=False) INT_OPTION = ConfigOption(ConfigOptionId('int.option', '', option_type=int), required=False) FLOAT_OPTION = ConfigOption(ConfigOptionId('float.option', '', option_type=float), required=False) BOOL_OPTION = ConfigOption(ConfigOptionId('bool.option', '', option_type=bool), required=False) FLAG_OPTION = ConfigOption(ConfigOptionId('flag.option', '', option_type=Flag()), required=False) PATH_OPTION = ConfigOption(ConfigOptionId('path.option', '', option_type=Path(exists=True)), required=False) CHOICE_OPTION = ConfigOption(ConfigOptionId('choice.option', '', option_type=Choice(['1', '2'])), required=False) CONFIG_CHOICE_OPTION = ConfigOption(ConfigOptionId( 'config.choice.option', '', option_type=ConfigChoice(MULTIPLE_STR_OPTION.option_id)), required=False) TRANSFORM_OPTION = ConfigOption(ConfigOptionId('transform.option',
with patch('sys.argv', ['zaf', '--count', '--count', 'command']): extension_config = self.plugin.get_config(self.config, [count_option], {COMMAND: []}) self.assertIn('count', extension_config.config) self.assertEqual(extension_config.config['count'], 1) COMMAND = CommandId('command', '', callable=None, config_options=[]) COMMAND_ALLOW_UNKNOWN = CommandId( 'command-unknown', '', callable=None, config_options=[], allow_unknown_options=True) REQUIRED = ConfigOption(ConfigOptionId('required', ''), required=True) ENTITY_IDS = ConfigOptionId('ids', '', entity=True, multiple=True, namespace='entities') DEPENDENT = ConfigOption(ConfigOptionId('dependent', '', at=ENTITY_IDS), required=True) REQUIRED_ARGUMENT = ConfigOptionId('required.arg', '', argument=True) SINGLE_ENTITY_ID = ConfigOptionId('id', '', entity=True, multiple=False, namespace='single') SINGLE_DEPENDENT = ConfigOption(ConfigOptionId('dependent', '', at=SINGLE_ENTITY_ID), required=True) FLAG = ConfigOption(ConfigOptionId('flag', '', option_type=Flag()), required=False) SHORT_ALIAS_OPTION = ConfigOption( ConfigOptionId('short.alias', '', short_alias=True, namespace='namespace'), required=False) SHORT_ALIAS_FLAG = ConfigOption( ConfigOptionId('short.alias', '', option_type=Flag(), short_alias=True, namespace='namespace'), required=False) SHORT_NAME_OPTION = ConfigOption(ConfigOptionId('short.name', '', short_name='s'), required=False) SHORT_NAME_FLAG = ConfigOption( ConfigOptionId('short.name', '', option_type=Flag(), short_name='s'), required=False) PARENT_COMMAND = CommandId('parent', '', callable=None, config_options=[]) CHILD_COMMAND = CommandId('child', '', callable=None, config_options=[], parent=PARENT_COMMAND) GRAND_CHILD_COMMAND = CommandId( 'grandchild', '', callable=None, config_options=[], parent=CHILD_COMMAND) MULTIPLE_ARGUEMENTS = ConfigOption( ConfigOptionId('multiple.args', '', argument=True, multiple=True), required=True) COMMAND_ALLOW_AND_CAPTURE_UNKNOWN = CommandId(
entity=True, multiple=True, namespace='entities') DEPENDENT = ConfigOption(ConfigOptionId('dependent', '', at=ENTITY_IDS), required=True) REQUIRED_ARGUMENT = ConfigOptionId('required.arg', '', argument=True) SINGLE_ENTITY_ID = ConfigOptionId('id', '', entity=True, multiple=False, namespace='single') SINGLE_DEPENDENT = ConfigOption(ConfigOptionId('dependent', '', at=SINGLE_ENTITY_ID), required=True) FLAG = ConfigOption(ConfigOptionId('flag', '', option_type=Flag()), required=False) SHORT_ALIAS_OPTION = ConfigOption(ConfigOptionId('short.alias', '', short_alias=True, namespace='namespace'), required=False) SHORT_ALIAS_FLAG = ConfigOption(ConfigOptionId('short.alias', '', option_type=Flag(), short_alias=True, namespace='namespace'), required=False) SHORT_NAME_OPTION = ConfigOption(ConfigOptionId('short.name', '', short_name='s'),
from zaf.config.options import ConfigOptionId from zaf.config.types import ConfigChoice, Flag COMMANDS = ConfigOptionId( 'commands', 'List of all commands', multiple=True, entity=True, ) COMMAND = ConfigOptionId('internal.command', 'The command to execute') TARGET_COMMAND = ConfigOptionId( 'command', 'The command to analyze', option_type=ConfigChoice(COMMANDS), namespace='target', short_alias=True) JSON_OUTPUT = ConfigOptionId('json', 'Convert output to json', option_type=Flag())