[Python-checkins] python/dist/src/Lib/test test_zipimport.py,1.1.2.2,1.1.2.3

jackjansen@users.sourceforge.net jackjansen@users.sourceforge.net
Sat, 04 Jan 2003 16:17:20 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv25930

Modified Files:
      Tag: r23a1-branch
	test_zipimport.py 
Log Message:
Various tweaks to make the test work on the Mac.

Index: test_zipimport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zipimport.py,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** test_zipimport.py	3 Jan 2003 11:24:31 -0000	1.1.2.2
--- test_zipimport.py	5 Jan 2003 00:17:17 -0000	1.1.2.3
***************
*** 16,20 ****
  def make_pyc(co, mtime):
      data = marshal.dumps(co)
!     pyc = imp.get_magic() + struct.pack("<i", mtime) + data
      return pyc
  
--- 16,26 ----
  def make_pyc(co, mtime):
      data = marshal.dumps(co)
!     if type(mtime) is type(0.0):
!     	# Mac mtimes need a bit of special casing
!     	if mtime < 0x7fffffff:
!     		mtime = int(mtime)
!     	else:
!     		mtime = int(-0x100000000L + long(mtime))
!     pyc = imp.get_magic() + struct.pack("<i", int(mtime)) + data
      return pyc
  
***************
*** 33,37 ****
  TESTPACK2 = "ziptestpackage2"
  TEMP_ZIP = os.path.abspath("junk95142.zip")
! 
  
  class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
--- 39,46 ----
  TESTPACK2 = "ziptestpackage2"
  TEMP_ZIP = os.path.abspath("junk95142.zip")
! if sys.platform == 'mac':
!     CURDIRPREFIX=':'
! else:
!     CURDIRPREFIX=''
  
  class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
***************
*** 60,64 ****
                  file = mod.get_file()
                  self.assertEquals(file, os.path.join(TEMP_ZIP,
!                                   os.sep.join(modules) + expected_ext))
          finally:
              z.close()
--- 69,73 ----
                  file = mod.get_file()
                  self.assertEquals(file, os.path.join(TEMP_ZIP,
!                                   CURDIRPREFIX + os.sep.join(modules) + expected_ext))
          finally:
              z.close()