[Python-checkins] python/dist/src/Lib/test test_zipimport.py,1.3,1.4

jackjansen@users.sourceforge.net jackjansen@users.sourceforge.net
Wed, 08 Jan 2003 08:37:06 -0800


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

Modified Files:
	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.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_zipimport.py	3 Jan 2003 11:18:56 -0000	1.3
--- test_zipimport.py	8 Jan 2003 16:37:03 -0000	1.4
***************
*** 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()