def test_global_executors(loop): assert not _global_executors with pytest.raises(ValueError): default_executor() with cluster() as (c, [a, b]): with Executor(('127.0.0.1', c['port']), loop=loop) as e: assert _global_executors == {e} assert default_executor() is e with Executor(('127.0.0.1', c['port']), loop=loop) as f: with pytest.raises(ValueError): default_executor() assert default_executor(e) is e assert default_executor(f) is f assert not _global_executors
def test_global_executors(loop): assert not _global_executor[0] with pytest.raises(ValueError): default_executor() with cluster() as (s, [a, b]): with Executor(('127.0.0.1', s['port']), loop=loop) as e: assert _global_executor == [e] assert default_executor() is e with Executor(('127.0.0.1', s['port']), loop=loop) as f: assert _global_executor == [f] assert default_executor() is f assert default_executor(e) is e assert default_executor(f) is f assert not _global_executor[0]