Adds a test for default file init command.
This commit is contained in:
@ -20,6 +20,7 @@ def get_graph():
|
||||
|
||||
return graph
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = bonobo.get_argument_parser()
|
||||
with bonobo.parse_args(parser):
|
||||
|
||||
@ -34,7 +34,9 @@ class ExecutorStrategy(Strategy):
|
||||
try:
|
||||
context.tick()
|
||||
except KeyboardInterrupt:
|
||||
logging.getLogger(__name__).warning('KeyboardInterrupt received. Trying to terminate the nodes gracefully.')
|
||||
logging.getLogger(__name__).warning(
|
||||
'KeyboardInterrupt received. Trying to terminate the nodes gracefully.'
|
||||
)
|
||||
context.kill()
|
||||
break
|
||||
|
||||
@ -50,8 +52,9 @@ class ExecutorStrategy(Strategy):
|
||||
with node:
|
||||
node.loop()
|
||||
except BaseException as exc:
|
||||
logging.getLogger(__name__).info('Got {} in {} runner.'.format(get_name(exc), node),
|
||||
exc_info=sys.exc_info())
|
||||
logging.getLogger(__name__).info(
|
||||
'Got {} in {} runner.'.format(get_name(exc), node), exc_info=sys.exc_info()
|
||||
)
|
||||
|
||||
futures.append(executor.submit(_runner))
|
||||
|
||||
|
||||
@ -112,6 +112,17 @@ def test_install_requirements_for_file(runner):
|
||||
install_mock.assert_called_once_with(os.path.join(dirname, 'requirements.txt'))
|
||||
|
||||
|
||||
@all_runners
|
||||
def test_init_file(runner, tmpdir):
|
||||
target = tmpdir.join('foo.py')
|
||||
runner('init', str(target))
|
||||
assert os.path.exists(target)
|
||||
|
||||
out, err = runner('run', str(target))
|
||||
assert out.replace('\n', ' ').strip() == 'Hello World'
|
||||
assert not err
|
||||
|
||||
|
||||
@all_runners
|
||||
def test_version(runner):
|
||||
out, err = runner('version')
|
||||
|
||||
Reference in New Issue
Block a user