'Importing top-level numba features should not import too many modules.'

def test_laziness(self):

    blacklist = ['cffi', 'distutils', 'numba.cuda', 'numba.hsa', 'numba.targets.mathimpl', 'numba.targets.randomimpl', 'numba.tests', 'numba.typing.collections', 'numba.typing.listdecl', 'numba.typing.npdatetime']
    for mod in blacklist:
        if (mod not in ('cffi', 'numba.hsa')):
            __import__(mod)
    code = 'if    1:\n                                                from    numba    import    jit,    types,    vectorize\n                                                import    sys\n                                                print(list(sys.modules))\n                                                '
    popen = subprocess.Popen([sys.executable, '-c', code], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    (out, err) = popen.communicate()
    if (popen.returncode != 0):
        raise AssertionError(('process    failed    with    code    %s:    stderr    follows\n%s\n' % (popen.returncode, err.decode())))
    modlist = set(eval(out.strip()))
    unexpected = (set(blacklist) & set(modlist))
    self.assertFalse(unexpected, 'some    modules    unexpectedly    imported')
