File test/config_args.py artifact 0b53c41a17 part of check-in 85f6aa649a


# type: test
# title: argparser
# description: use arg:--param values
# config:
#   { arg: --help, name: help, value: 0, type: bool, description: flag }
#   { arg: -D,     type: boolean,  name: debug,     description: Enable debug messages on console }
#   { arg: action, type: str *,    name: action[],  description: CLI interface commands. }
# version: 0.1
# 
# Do all the settings!

import pytest
import pluginconf

@pytest.fixture
def args():
    return [
        pluginconf.argparse_map(opt)
        for opt in
        pluginconf.plugin_meta(fn=__file__)["config"]
    ]

def all(args):
    assert args == [
        {'args': ['--help'], 'dest': 'help', 'action': 'store_false', 'default': '0', 'help': 'flag'},
        {'args': ['-D'], 'dest': 'debug', 'action': 'store_true', 'help': 'Enable debug messages on console'},
        {'args': ['action'], 'action': 'store', 'nargs': '*', 'type': str, 'help': 'CLI interface commands.'},
    ]