summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/pydoc.py8
-rw-r--r--Lib/test/test_structseq.py6
-rw-r--r--Lib/test/test_sys.py13
3 files changed, 22 insertions, 5 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 1bab8e3..5d764eb 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1834,7 +1834,9 @@ Please wait a moment while I gather a list of all available modules...
modname = modname[:-9] + ' (package)'
if modname.find('.') < 0:
modules[modname] = 1
- ModuleScanner().run(callback)
+ def onerror(modname):
+ callback(None, modname, None)
+ ModuleScanner().run(callback, onerror=onerror)
self.list(modules.keys())
self.output.write('''
Enter any module name to get more help. Or, type "modules spam" to search
@@ -1870,7 +1872,7 @@ class Scanner:
class ModuleScanner:
"""An interruptible scanner that searches module synopses."""
- def run(self, callback, key=None, completer=None):
+ def run(self, callback, key=None, completer=None, onerror=None):
if key: key = key.lower()
self.quit = False
seen = {}
@@ -1887,7 +1889,7 @@ class ModuleScanner:
if name.lower().find(key) >= 0:
callback(None, modname, desc)
- for importer, modname, ispkg in pkgutil.walk_packages():
+ for importer, modname, ispkg in pkgutil.walk_packages(onerror=onerror):
if self.quit:
break
if key is None:
diff --git a/Lib/test/test_structseq.py b/Lib/test/test_structseq.py
index 7a18fb2..7ba142b 100644
--- a/Lib/test/test_structseq.py
+++ b/Lib/test/test_structseq.py
@@ -28,7 +28,11 @@ class StructSeqTest(unittest.TestCase):
def test_repr(self):
t = time.gmtime()
- repr(t)
+ self.assert_(repr(t))
+ t = time.gmtime(0)
+ self.assertEqual(repr(t),
+ "time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, "
+ "tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)")
def test_concat(self):
t1 = time.gmtime()
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 0a62c01..264544d 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -279,8 +279,8 @@ class SysModuleTest(unittest.TestCase):
self.assert_(isinstance(sys.copyright, str))
self.assert_(isinstance(sys.exec_prefix, str))
self.assert_(isinstance(sys.executable, str))
- self.assert_(isinstance(sys.float_info, dict))
self.assertEqual(len(sys.float_info), 11)
+ self.assertEqual(sys.float_info.radix, 2)
self.assert_(isinstance(sys.hexversion, int))
self.assert_(isinstance(sys.maxsize, int))
self.assert_(isinstance(sys.maxunicode, int))
@@ -320,6 +320,17 @@ class SysModuleTest(unittest.TestCase):
self.assertRaises(TypeError, sys.intern, S("abc"))
+ def test_sys_flags(self):
+ self.failUnless(sys.flags)
+ attrs = ("debug", "division_warning",
+ "inspect", "interactive", "optimize", "dont_write_bytecode",
+ "no_site", "ingnore_environment", "tabcheck", "verbose")
+ for attr in attrs:
+ self.assert_(hasattr(sys.flags, attr), attr)
+ self.assertEqual(type(getattr(sys.flags, attr)), int, attr)
+ self.assert_(repr(sys.flags))
+
+
def test_main():
test.test_support.run_unittest(SysModuleTest)