Files
bonobo/tests/test_commands.py
2017-05-22 19:25:35 +02:00

44 lines
1.0 KiB
Python

import pkg_resources
import pytest
from bonobo import get_examples_path, __version__
from bonobo.commands import entrypoint
def test_entrypoint():
commands = {}
for command in pkg_resources.iter_entry_points('bonobo.commands'):
commands[command.name] = command
assert 'init' in commands
assert 'run' in commands
def test_no_command(capsys):
with pytest.raises(SystemExit):
entrypoint([])
_, err = capsys.readouterr()
assert 'error: the following arguments are required: command' in err
def test_init():
pass # need ext dir
def test_run(capsys):
entrypoint(['run', '--quiet', get_examples_path('types/strings.py')])
out, err = capsys.readouterr()
out = out.split('\n')
assert out[0].startswith('Foo ')
assert out[1].startswith('Bar ')
assert out[2].startswith('Baz ')
def test_version(capsys):
entrypoint(['version'])
out, err = capsys.readouterr()
out = out.strip()
assert out.startswith('bonobo ')
assert out.endswith(__version__)