How to use the tomodachi.cli.cli_entrypoint function in tomodachi

To help you get started, weโ€™ve selected a few tomodachi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kalaspuff / tomodachi / tests / test_cli.py View on Github external
def test_cli_start_exception_service_init(monkeypatch: Any, capsys: Any) -> None:
    monkeypatch.setattr(logging.root, 'handlers', [])

    with pytest.raises(SystemExit):
        tomodachi.cli.cli_entrypoint(['tomodachi', 'run', 'tests/services/exception_service_init.py'])

    out, err = capsys.readouterr()
    assert err != ''
    assert 'Starting services' in out
    assert 'tomodachi/{}'.format(tomodachi.__version__) in out
    assert 'fail in __init__()' in err
github kalaspuff / tomodachi / tests / test_cli.py View on Github external
def test_cli_entrypoint_print_dependency_versions(monkeypatch: Any, capsys: Any) -> None:
    monkeypatch.setattr(logging.root, 'handlers', [])

    with pytest.raises(SystemExit):
        tomodachi.cli.cli_entrypoint(['tomodachi', '--dependency-versions'])

    out, err = capsys.readouterr()
    assert err == ''
    assert out != 'tomodachi/{}'.format(tomodachi.__version__) + "\n"

    import aiobotocore
    assert 'aiobotocore/{}'.format(aiobotocore.__version__) + "\n" in out
github kalaspuff / tomodachi / tests / test_cli.py View on Github external
def test_cli_entrypoint_print_version(monkeypatch: Any, capsys: Any) -> None:
    monkeypatch.setattr(logging.root, 'handlers', [])

    with pytest.raises(SystemExit):
        tomodachi.cli.cli_entrypoint(['tomodachi', '-v'])

    out, err = capsys.readouterr()
    assert err == ''
    assert out == 'tomodachi/{}'.format(tomodachi.__version__) + "\n"
github kalaspuff / tomodachi / tests / test_cli.py View on Github external
def test_cli_start_service_with_invalid_config(monkeypatch: Any, capsys: Any) -> None:
    monkeypatch.setattr(logging.root, 'handlers', [])

    with pytest.raises(SystemExit):
        tomodachi.cli.cli_entrypoint(['tomodachi', 'run', 'tests/services/auto_closing_service.py', '-c', 'tests/configs/invalid_config_file.json'])

    out, err = capsys.readouterr()
    assert 'Starting services' not in out
    assert 'tomodachi/{}'.format(tomodachi.__version__) not in out
    assert 'Invalid config file, invalid JSON format' in out
github kalaspuff / tomodachi / tests / test_cli.py View on Github external
def test_cli_start_service_with_non_existing_config(monkeypatch: Any, capsys: Any) -> None:
    monkeypatch.setattr(logging.root, 'handlers', [])

    with pytest.raises(SystemExit):
        tomodachi.cli.cli_entrypoint(['tomodachi', 'run', 'tests/services/auto_closing_service.py', '-c', 'tests/configs/without_config_file.json'])

    out, err = capsys.readouterr()
    assert 'Starting services' not in out
    assert 'tomodachi/{}'.format(tomodachi.__version__) not in out
    assert 'Invalid config file' in out
github kalaspuff / tomodachi / tests / test_cli.py View on Github external
def test_cli_entrypoint_invalid_arguments_show_help(monkeypatch: Any, capsys: Any) -> None:
    cli = tomodachi.cli.CLI()
    monkeypatch.setattr(logging.root, 'handlers', [])

    with pytest.raises(SystemExit):
        tomodachi.cli.cli_entrypoint(['tomodachi', '--invalid'])

    out, err = capsys.readouterr()
    assert err == ''
    assert out == cli.help_command_usage() + "\n"
github kalaspuff / tomodachi / tests / test_cli.py View on Github external
def test_cli_entrypoint_print_help(monkeypatch: Any, capsys: Any) -> None:
    cli = tomodachi.cli.CLI()
    monkeypatch.setattr(logging.root, 'handlers', [])

    with pytest.raises(SystemExit):
        tomodachi.cli.cli_entrypoint(['tomodachi', '-h'])

    out, err = capsys.readouterr()
    assert err == ''
    assert out == cli.help_command_usage() + "\n"
github kalaspuff / tomodachi / tomodachi.py View on Github external
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""tomodachi.py: microservice framework"""

import sys

if __name__ == "__main__":
    if not sys.version_info >= (3, 6):
        print("tomodachi doesn't support Python earlier than 3.6")
        sys.exit(1)

    import tomodachi.cli
    tomodachi.cli.cli_entrypoint()
github kalaspuff / tomodachi / tomodachi / __main__.py View on Github external
#!/usr/bin/env python
import tomodachi.cli

if __name__ == "__main__":
    tomodachi.cli.cli_entrypoint()