Source

sphinx-multiprocessing / tests / test_multiprocessingimpl.py

# -*- coding: utf-8 -*-
"""
    test_multiprocessingimpl
    ~~~~~~~~~~~~~~~~~~~~~~~~

    :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""
from sphinx.util.multiprocessingimpl import DummyPool, make_pool

def test_dummy_pool():
    pool = DummyPool()
    pool = DummyPool(2)
    values = range(10)
    for i, result in enumerate(pool.imap(lambda x: x, values)):
        assert result == values[i]

def test_make_pool():
    pool = make_pool()
    assert getattr(pool, 'imap', False)