summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/tests/test_dist.py5
-rw-r--r--Lib/lib-tk/Tkinter.py3
-rw-r--r--Lib/rlcompleter.py5
-rw-r--r--Lib/sched.py2
-rw-r--r--Lib/test/test_eof.py5
-rw-r--r--Lib/test/test_zipimport.py32
-rw-r--r--Lib/unittest.py4
7 files changed, 47 insertions, 9 deletions
diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py
index 81459ac..dd07735 100644
--- a/Lib/distutils/tests/test_dist.py
+++ b/Lib/distutils/tests/test_dist.py
@@ -213,9 +213,10 @@ class MetadataTestCase(unittest.TestCase):
# win32-style
if sys.platform == 'win32':
# home drive should be found
- os.environ['HOMEPATH'] = curdir
+ os.environ['HOME'] = curdir
files = dist.find_config_files()
- self.assert_(user_filename in files)
+ self.assert_(user_filename in files,
+ '%r not found in %r' % (user_filename, files))
finally:
for key, value in old.items():
if value is None:
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index 23ebe54..d600f29 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -589,9 +589,6 @@ class Misc:
status = self.tk.call('grab', 'status', self._w)
if status == 'none': status = None
return status
- def lower(self, belowThis=None):
- """Lower this widget in the stacking order."""
- self.tk.call('lower', self._w, belowThis)
def option_add(self, pattern, value, priority = None):
"""Set a VALUE (second parameter) for an option
PATTERN (first parameter).
diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py
index c605c7d..10a53dc 100644
--- a/Lib/rlcompleter.py
+++ b/Lib/rlcompleter.py
@@ -121,7 +121,10 @@ class Completer:
if not m:
return []
expr, attr = m.group(1, 3)
- object = eval(expr, self.namespace)
+ try:
+ object = eval(expr, self.namespace)
+ except Exception:
+ return []
words = dir(object)
if hasattr(object,'__class__'):
words.append('__class__')
diff --git a/Lib/sched.py b/Lib/sched.py
index 1c7bfea..aecdb2a 100644
--- a/Lib/sched.py
+++ b/Lib/sched.py
@@ -117,7 +117,7 @@ class scheduler:
action(*argument)
delayfunc(0) # Let other threads run
else:
- heapq.heappush(event)
+ heapq.heappush(q, event)
@property
def queue(self):
diff --git a/Lib/test/test_eof.py b/Lib/test/test_eof.py
index 4284d11..91fd845 100644
--- a/Lib/test/test_eof.py
+++ b/Lib/test/test_eof.py
@@ -6,7 +6,7 @@ from test import test_support
class EOFTestCase(unittest.TestCase):
def test_EOFC(self):
- expect = "EOL while scanning single-quoted string (<string>, line 1)"
+ expect = "EOL while scanning string literal (<string>, line 1)"
try:
eval("""'this is a test\
""")
@@ -16,7 +16,8 @@ class EOFTestCase(unittest.TestCase):
raise test_support.TestFailed
def test_EOFS(self):
- expect = "EOF while scanning triple-quoted string (<string>, line 1)"
+ expect = ("EOF while scanning triple-quoted string literal "
+ "(<string>, line 1)")
try:
eval("""'''this is a test""")
except SyntaxError as msg:
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py
index d2758b4..c7da859 100644
--- a/Lib/test/test_zipimport.py
+++ b/Lib/test/test_zipimport.py
@@ -209,6 +209,7 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
z.close()
zi = zipimport.zipimporter(TEMP_ZIP)
+ self.assertEquals(zi.archive, TEMP_ZIP)
self.assertEquals(zi.is_package(TESTPACK), True)
zi.load_module(TESTPACK)
@@ -229,6 +230,37 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
z.close()
os.remove(TEMP_ZIP)
+ def testZipImporterMethodsInSubDirectory(self):
+ packdir = TESTPACK + os.sep
+ packdir2 = packdir + TESTPACK2 + os.sep
+ files = {packdir2 + "__init__" + pyc_ext: (NOW, test_pyc),
+ packdir2 + TESTMOD + pyc_ext: (NOW, test_pyc)}
+
+ z = ZipFile(TEMP_ZIP, "w")
+ try:
+ for name, (mtime, data) in files.items():
+ zinfo = ZipInfo(name, time.localtime(mtime))
+ zinfo.compress_type = self.compression
+ z.writestr(zinfo, data)
+ z.close()
+
+ zi = zipimport.zipimporter(TEMP_ZIP + os.sep + packdir)
+ self.assertEquals(zi.archive, TEMP_ZIP)
+ self.assertEquals(zi.prefix, packdir)
+ self.assertEquals(zi.is_package(TESTPACK2), True)
+ zi.load_module(TESTPACK2)
+
+ self.assertEquals(zi.is_package(TESTPACK2 + os.sep + '__init__'), False)
+ self.assertEquals(zi.is_package(TESTPACK2 + os.sep + TESTMOD), False)
+
+ mod_name = TESTPACK2 + os.sep + TESTMOD
+ mod = __import__(module_path_to_dotted_name(mod_name))
+ self.assertEquals(zi.get_source(TESTPACK2), None)
+ self.assertEquals(zi.get_source(mod_name), None)
+ finally:
+ z.close()
+ os.remove(TEMP_ZIP)
+
def testGetData(self):
z = ZipFile(TEMP_ZIP, "w")
z.compression = self.compression
diff --git a/Lib/unittest.py b/Lib/unittest.py
index 742871b..5beeb05 100644
--- a/Lib/unittest.py
+++ b/Lib/unittest.py
@@ -679,6 +679,7 @@ class _TextTestResult(TestResult):
if self.showAll:
self.stream.write(self.getDescription(test))
self.stream.write(" ... ")
+ self.stream.flush()
def addSuccess(self, test):
TestResult.addSuccess(self, test)
@@ -686,6 +687,7 @@ class _TextTestResult(TestResult):
self.stream.writeln("ok")
elif self.dots:
self.stream.write('.')
+ self.stream.flush()
def addError(self, test, err):
TestResult.addError(self, test, err)
@@ -693,6 +695,7 @@ class _TextTestResult(TestResult):
self.stream.writeln("ERROR")
elif self.dots:
self.stream.write('E')
+ self.stream.flush()
def addFailure(self, test, err):
TestResult.addFailure(self, test, err)
@@ -700,6 +703,7 @@ class _TextTestResult(TestResult):
self.stream.writeln("FAIL")
elif self.dots:
self.stream.write('F')
+ self.stream.flush()
def printErrors(self):
if self.dots or self.showAll: