Adds a test for default file init command.
This commit is contained in:
@ -20,6 +20,7 @@ def get_graph():
|
|||||||
|
|
||||||
return graph
|
return graph
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = bonobo.get_argument_parser()
|
parser = bonobo.get_argument_parser()
|
||||||
with bonobo.parse_args(parser):
|
with bonobo.parse_args(parser):
|
||||||
|
|||||||
@ -34,7 +34,9 @@ class ExecutorStrategy(Strategy):
|
|||||||
try:
|
try:
|
||||||
context.tick()
|
context.tick()
|
||||||
except KeyboardInterrupt:
|
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()
|
context.kill()
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -50,8 +52,9 @@ class ExecutorStrategy(Strategy):
|
|||||||
with node:
|
with node:
|
||||||
node.loop()
|
node.loop()
|
||||||
except BaseException as exc:
|
except BaseException as exc:
|
||||||
logging.getLogger(__name__).info('Got {} in {} runner.'.format(get_name(exc), node),
|
logging.getLogger(__name__).info(
|
||||||
exc_info=sys.exc_info())
|
'Got {} in {} runner.'.format(get_name(exc), node), exc_info=sys.exc_info()
|
||||||
|
)
|
||||||
|
|
||||||
futures.append(executor.submit(_runner))
|
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'))
|
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
|
@all_runners
|
||||||
def test_version(runner):
|
def test_version(runner):
|
||||||
out, err = runner('version')
|
out, err = runner('version')
|
||||||
|
|||||||
Reference in New Issue
Block a user