def mock_modules():

    from mock import MagicMock

    try:
        import yappi  # noqa
    except ImportError:
        MOCK_MODULES = ['yappi']
    else:
        MOCK_MODULES = []

    try:
        import zmq  # noqa
    except __HOLE__:
        MOCK_MODULES.append('zmq')

    try:
        import line_profiler  # noqa
    except ImportError:
        MOCK_MODULES.append('line_profiler')

    class Mock(MagicMock):

        @classmethod
        def __getattr__(cls, name):
            return Mock()

        def __call__(self, *args, **kwards):
            return Mock()

        def __name__(self, other):
            return 'Mock'

    sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
    print 'mocking {}'.format(MOCK_MODULES)

# -- General configuration ----------------------------------------------------
dataset/ETHPy150Open enthought/pikos/docs/conf.py/mock_modules