Commit a934e17a authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME

Add more constraining test

parent 0f565efd
## Configuration file automatically generated at 05/07/2018 for cli test.
## Path leading to test blablabla.
## Option: -t, --test [default: /my/path/test.txt]
# test = /my/path/test.txt
import click import click
import pkg_resources
from click.testing import CliRunner from click.testing import CliRunner
from bob.extension.scripts.click_helper import ( from bob.extension.scripts.click_helper import (
verbosity_option, bool_option, list_float_option, verbosity_option, bool_option, list_float_option,
...@@ -178,7 +179,7 @@ def test_config_dump(): ...@@ -178,7 +179,7 @@ def test_config_dump():
def cli(): def cli():
pass pass
@click.command(cls=ConfigCommand) @cli.command(cls=ConfigCommand)
@click.option('-t', '--test', required=True, default="/my/path/test.txt", @click.option('-t', '--test', required=True, default="/my/path/test.txt",
help="Path leading to test blablabla", cls=ResourceOption) help="Path leading to test blablabla", cls=ResourceOption)
@verbosity_option() @verbosity_option()
...@@ -186,5 +187,9 @@ def test_config_dump(): ...@@ -186,5 +187,9 @@ def test_config_dump():
pass pass
runner = CliRunner() runner = CliRunner()
with runner.isolated_filesystem(): with runner.isolated_filesystem():
result = runner.invoke(cli, ['test', '-dc', 'TEST_CONF'], catch_exceptions=False) result = runner.invoke(cli, ['test', '-H', 'TEST_CONF'], catch_exceptions=False)
assert result.exit_code != 0, (result.exit_code, result.output) ref = pkg_resources.resource_filename('bob.extension',
assert result.exit_code == 0, (result.exit_code, result.output)
with open('TEST_CONF', 'r') as f, open(ref, 'r') as f2:
assert ==
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment