Beispiel #1
0
def test_start_ipython_remote(loop, zmq_ctx):
    from distributed._ipython_utils import remote_magic
    with cluster(1) as (s, [a]):
        with Client(('127.0.0.1', s['port']), loop=loop) as e, mock_ipython() as ip:
            worker = first(e.ncores())
            ip.user_ns['info'] = e.start_ipython_workers(worker)[worker]
            remote_magic('info 1') # line magic
            remote_magic('info', 'worker') # cell magic

        expected = [
            ((remote_magic,), {'magic_kind': 'line', 'magic_name': 'remote'}),
            ((remote_magic,), {'magic_kind': 'cell', 'magic_name': 'remote'}),
        ]
        assert ip.register_magic_function.call_args_list == expected
        assert ip.register_magic_function.call_count == 2
def test_start_ipython_remote(loop, zmq_ctx):
    from distributed._ipython_utils import remote_magic

    with cluster(1) as (s, [a]):
        with Client(s["address"], loop=loop) as e, mock_ipython() as ip:
            worker = first(e.nthreads())
            ip.user_ns["info"] = e.start_ipython_workers(worker)[worker]
            remote_magic("info 1")  # line magic
            remote_magic("info", "worker")  # cell magic

        expected = [
            ((remote_magic,), {"magic_kind": "line", "magic_name": "remote"}),
            ((remote_magic,), {"magic_kind": "cell", "magic_name": "remote"}),
        ]
        assert ip.register_magic_function.call_args_list == expected
        assert ip.register_magic_function.call_count == 2
def test_start_ipython_remote(loop, zmq_ctx):
    from distributed._ipython_utils import remote_magic
    with cluster(1) as (s, [a]):
        with Client(s['address'], loop=loop) as e, mock_ipython() as ip:
            worker = first(e.ncores())
            ip.user_ns['info'] = e.start_ipython_workers(worker)[worker]
            remote_magic('info 1')  # line magic
            remote_magic('info', 'worker')  # cell magic

        expected = [
            ((remote_magic, ), {
                'magic_kind': 'line',
                'magic_name': 'remote'
            }),
            ((remote_magic, ), {
                'magic_kind': 'cell',
                'magic_name': 'remote'
            }),
        ]
        assert ip.register_magic_function.call_args_list == expected
        assert ip.register_magic_function.call_count == 2