from test
import test_support
from test
.test_support
import verify
, verbose
warnings
.filterwarnings("ignore", ".* 'pre' .*", DeprecationWarning,
warnings
.filterwarnings("ignore", ".* regsub .*", DeprecationWarning,
warnings
.filterwarnings("ignore", ".* statcache .*", DeprecationWarning,
class AllTest(unittest
.TestCase
):
def check_all(self
, modname
):
exec "import %s" % modname
in names
# Silent fail here seems the best route since some modules
# may not be available in all environments.
verify(hasattr(sys
.modules
[modname
], "__all__"),
"%s has no __all__ attribute" % modname
)
exec "from %s import *" % modname
in names
if names
.has_key("__builtins__"):
del names
["__builtins__"]
all
= set(sys
.modules
[modname
].__all
__)
verify(keys
==all
, "%s != %s" % (keys
, all
))
if not sys
.platform
.startswith('java'):
# In case _socket fails to build, make this test fail more gracefully
# than an AttributeError somewhere deep in CGIHTTPServer.
self
.check_all("BaseHTTPServer")
self
.check_all("Bastion")
self
.check_all("CGIHTTPServer")
self
.check_all("ConfigParser")
self
.check_all("MimeWriter")
self
.check_all("SimpleHTTPServer")
self
.check_all("SocketServer")
self
.check_all("StringIO")
self
.check_all("UserString")
self
.check_all("audiodev")
self
.check_all("calendar")
self
.check_all("colorsys")
self
.check_all("commands")
self
.check_all("compileall")
self
.check_all("copy_reg")
self
.check_all("decimal")
self
.check_all("difflib")
self
.check_all("dircache")
self
.check_all("doctest")
self
.check_all("dummy_thread")
self
.check_all("dummy_threading")
self
.check_all("filecmp")
self
.check_all("fileinput")
self
.check_all("fnmatch")
self
.check_all("fpformat")
self
.check_all("getpass")
self
.check_all("gettext")
self
.check_all("gopherlib")
self
.check_all("htmllib")
self
.check_all("httplib")
self
.check_all("imaplib")
self
.check_all("imputil")
self
.check_all("keyword")
self
.check_all("linecache")
self
.check_all("macpath")
self
.check_all("macurl2path")
self
.check_all("mailbox")
self
.check_all("mailcap")
self
.check_all("mimetools")
self
.check_all("mimetypes")
self
.check_all("multifile")
self
.check_all("nntplib")
self
.check_all("optparse")
self
.check_all("os2emxpath")
self
.check_all("pickletools")
self
.check_all("posixpath")
self
.check_all("pre") # deprecated
self
.check_all("profile")
self
.check_all("py_compile")
self
.check_all("reconvert")
self
.check_all("rlcompleter")
self
.check_all("robotparser")
self
.check_all("sgmllib")
self
.check_all("smtplib")
self
.check_all("_strptime")
self
.check_all("statcache")
self
.check_all("symtable")
self
.check_all("tabnanny")
self
.check_all("tarfile")
self
.check_all("telnetlib")
self
.check_all("tempfile")
self
.check_all("textwrap")
self
.check_all("threading")
self
.check_all("tokenize")
self
.check_all("traceback")
self
.check_all("unittest")
self
.check_all("urlparse")
self
.check_all("warnings")
self
.check_all("weakref")
self
.check_all("webbrowser")
self
.check_all("zipfile")
# rlcompleter needs special consideration; it import readline which
# initializes GNU readline which calls setlocale(LC_CTYPE, "")... :-(
self
.check_all("rlcompleter")
locale
.setlocale(locale
.LC_CTYPE
, 'C')
test_support
.run_unittest(AllTest
)
if __name__
== "__main__":