mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Merged revisions 63066-63076,63079,63081-63085,63087-63097,63099,63101-63104 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r63066 | georg.brandl | 2008-05-11 10:56:04 -0400 (Sun, 11 May 2008) | 2 lines #2709 followup: better description of Tk's pros and cons. ........ r63067 | georg.brandl | 2008-05-11 11:05:13 -0400 (Sun, 11 May 2008) | 2 lines #1326: document and test zipimporter.archive and zipimporter.prefix. ........ r63068 | georg.brandl | 2008-05-11 11:07:39 -0400 (Sun, 11 May 2008) | 2 lines #2816: clarify error messages for EOF while scanning strings. ........ r63069 | georg.brandl | 2008-05-11 11:17:41 -0400 (Sun, 11 May 2008) | 3 lines #2787: Flush stdout after writing test name, helpful when running hanging or long-running tests. Patch by Adam Olsen. ........ r63070 | georg.brandl | 2008-05-11 11:20:16 -0400 (Sun, 11 May 2008) | 3 lines #2803: fix wrong invocation of heappush in seldom-reached code. Thanks to Matt Harden. ........ r63073 | benjamin.peterson | 2008-05-11 12:38:07 -0400 (Sun, 11 May 2008) | 2 lines broaden .bzrignore ........ r63076 | andrew.kuchling | 2008-05-11 15:15:52 -0400 (Sun, 11 May 2008) | 1 line Add message to test assertion ........ r63083 | andrew.kuchling | 2008-05-11 16:08:33 -0400 (Sun, 11 May 2008) | 1 line Try setting HOME env.var to fix test on Win32 ........ r63092 | georg.brandl | 2008-05-11 16:53:55 -0400 (Sun, 11 May 2008) | 2 lines #2809 followup: even better split docstring. ........ r63094 | georg.brandl | 2008-05-11 17:03:42 -0400 (Sun, 11 May 2008) | 4 lines - #2250: Exceptions raised during evaluation of names in rlcompleter's ``Completer.complete()`` method are now caught and ignored. ........ r63095 | georg.brandl | 2008-05-11 17:16:37 -0400 (Sun, 11 May 2008) | 2 lines Clarify os.strerror()s exception behavior. ........ r63097 | georg.brandl | 2008-05-11 17:34:10 -0400 (Sun, 11 May 2008) | 2 lines #2535: remove duplicated method. ........ r63104 | alexandre.vassalotti | 2008-05-11 19:04:27 -0400 (Sun, 11 May 2008) | 2 lines Moved the Queue module stub in lib-old. ........
This commit is contained in:
parent
d6bb7c2c40
commit
8ae3e055a5
17 changed files with 92 additions and 41 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue