def test_with_configfile2__usable_as_alternative(self, cli_runner_isolated):
assert ConfigFileProcessor1.config_files[1] == "hello.cfg"
CONFIG_FILE_CONTENTS2 = """
[hello]
name = Bob
"""
write_configfile_with_contents("hello.cfg", CONFIG_FILE_CONTENTS2)
assert not os.path.exists("hello.ini")
assert os.path.exists("hello.cfg")
CONTEXT_SETTINGS = dict(default_map=ConfigFileProcessor1.read_config())
@click.command(context_settings=CONTEXT_SETTINGS)
@click.option("-n", "--name", default="__CMDLINE__")
def hello(name):
click.echo("Hello %s" % name)
result = cli_runner_isolated.invoke(hello)
assert result.output == "Hello Bob\n"
assert result.exit_code == 0
评论列表
文章目录