def METHOD_NAME(self, modname):
    names = {}
    with support.check_warnings((".* (module|package)",
                                 DeprecationWarning), quiet=True):
        try:
            exec "import %s" % modname in names
        except:
            # Silent fail here seems the best route since some modules
            # may not be available or not initialize properly in all
            # environments.
            raise FailedImport(modname)
    if not hasattr(sys.modules[modname], "__all__"):
        raise NoAll(modname)
    names = {}
    try:
        exec "from %s import *" % modname in names
    except Exception as e:
        # Include the module name in the exception string
        self.fail("__all__ failure in {}: {}: {}".format(
                  modname, e.__class__.__name__, e))
    if "__builtins__" in names:
        del names["__builtins__"]
    keys = set(names)
    all = set(sys.modules[modname].__all__)
    self.assertEqual(keys, all)