import multiprocessing
import unittest


def requires_multiprocessing(test_item):
    """Decorator that skips test if run on single-core CPU.

    Args:
        test_item (callable): function or class to be decorated.

    Returns:
        callable: the decorated function.
    """
    skip = multiprocessing.cpu_count() <= 1
    reason = 'Multicore CPU not available, skipping test'
    return unittest.skipIf(skip, reason)(test_item)