コード例 #1
0
ファイル: test_shell.py プロジェクト: SivagnanamCiena/nameko
def test_plain_fallback(pystartup):
    parser = setup_parser()
    args = parser.parse_args(['shell', '--interface', 'bpython'])

    with patch('nameko.cli.shell.code') as code:
        main(args)

    _, kwargs = code.interact.call_args
    local = kwargs['local']
    assert 'n' in local.keys()
    assert local['foo'] == 42
    local['n'].disconnect()
コード例 #2
0
ファイル: test_shell.py プロジェクト: SivagnanamCiena/nameko
def test_ipython(pystartup):
    parser = setup_parser()
    args = parser.parse_args(['shell', '--interface', 'ipython'])

    with patch('IPython.embed') as embed:
        main(args)

    _, kwargs = embed.call_args
    local = kwargs['user_ns']
    assert 'n' in local.keys()
    assert local['foo'] == 42
    local['n'].disconnect()
コード例 #3
0
def test_ipython(pystartup):
    parser = setup_parser()
    args = parser.parse_args(['shell', '--interface', 'ipython'])

    with patch('IPython.embed') as embed:
        main(args)

    _, kwargs = embed.call_args
    local = kwargs['user_ns']
    assert 'n' in local.keys()
    assert local['foo'] == 42
    local['n'].disconnect()
コード例 #4
0
def test_plain_fallback(pystartup):
    parser = setup_parser()
    args = parser.parse_args(['shell', '--interface', 'bpython'])

    with patch('nameko.cli.shell.code') as code:
        main(args)

    _, kwargs = code.interact.call_args
    local = kwargs['local']
    assert 'n' in local.keys()
    assert local['foo'] == 42
    local['n'].disconnect()
コード例 #5
0
ファイル: test_shell.py プロジェクト: Costeijn/nameko
def test_config(pystartup):
    parser = setup_parser()
    args = parser.parse_args(['shell', '--config', TEST_CONFIG_FILE])

    with patch('nameko.cli.shell.code') as code:
        main(args)

    _, kwargs = code.interact.call_args
    local = kwargs['local']
    assert 'n' in local.keys()
    assert local['n'].config == {
        WEB_SERVER_CONFIG_KEY: '0.0.0.0:8001',
        AMQP_URI_CONFIG_KEY: 'amqp://*****:*****@localhost',
        SERIALIZER_CONFIG_KEY: 'json'
    }
    local['n'].disconnect()
コード例 #6
0
ファイル: test_shell.py プロジェクト: xorllc/nameko
def test_config(pystartup):
    parser = setup_parser()
    args = parser.parse_args(['shell', '--config', TEST_CONFIG_FILE])

    with patch('nameko.cli.shell.code') as code:
        main(args)

    _, kwargs = code.interact.call_args
    local = kwargs['local']
    assert 'n' in local.keys()
    assert local['n'].config == {
        WEB_SERVER_CONFIG_KEY: '0.0.0.0:8001',
        AMQP_URI_CONFIG_KEY: 'amqp://*****:*****@localhost',
        SERIALIZER_CONFIG_KEY: 'json'
    }
    local['n'].disconnect()
コード例 #7
0
ファイル: test_shell.py プロジェクト: wfxiang08/nameko
def test_basic(tmpdir):
    parser = setup_parser()
    args = parser.parse_args(['shell'])

    startup = tmpdir.join('startup.py')
    startup.write('foo = 42')

    with patch('nameko.cli.shell.os.environ') as environ:
        environ.get.return_value = str(startup)
        with patch('nameko.cli.shell.code') as code:
            main(args)

    _, kwargs = code.interact.call_args
    local = kwargs['local']
    assert 'n' in local.keys()
    assert local['foo'] == 42
    local['n'].disconnect()