[Python-checkins] CVS: python/dist/src/Lib/test test_largefile.py,1.6,1.7

Tim Peters tim_one@users.sourceforge.net
Wed, 05 Sep 2001 17:32:17 -0700


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

Modified Files:
	test_largefile.py 
Log Message:
Enable large file support on Win32 systems.
Curious:  the MS docs say stati64 etc are supported even on Win95, but
Win95 doesn't support a filesystem that allows partitions > 2 Gb.

test_largefile:  This was opening its test file in text mode.  I have no
idea how that worked under Win64, but it sure needs binary mode on Win98.
BTW, on Win98 test_largefile runs quickly (under a second).


Index: test_largefile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_largefile.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** test_largefile.py	2001/09/05 17:52:31	1.6
--- test_largefile.py	2001/09/06 00:32:15	1.7
***************
*** 13,17 ****
  
  # only run if the current system support large files
! f = open(test_support.TESTFN, 'w')
  try:
      # 2**31 == 2147483648
--- 13,17 ----
  
  # only run if the current system support large files
! f = open(test_support.TESTFN, 'wb')
  try:
      # 2**31 == 2147483648
***************
*** 59,69 ****
  if test_support.verbose:
      print 'create large file via seek (may be sparse file) ...'
! f = open(name, 'w')
  f.seek(size)
  f.write('a')
  f.flush()
- expect(os.fstat(f.fileno())[stat.ST_SIZE], size+1)
  if test_support.verbose:
      print 'check file size with os.fstat'
  f.close()
  if test_support.verbose:
--- 59,69 ----
  if test_support.verbose:
      print 'create large file via seek (may be sparse file) ...'
! f = open(name, 'wb')
  f.seek(size)
  f.write('a')
  f.flush()
  if test_support.verbose:
      print 'check file size with os.fstat'
+ expect(os.fstat(f.fileno())[stat.ST_SIZE], size+1)
  f.close()
  if test_support.verbose:
***************
*** 73,77 ****
  if test_support.verbose:
      print 'play around with seek() and read() with the built largefile'
! f = open(name, 'r')
  expect(f.tell(), 0)
  expect(f.read(1), '\000')
--- 73,77 ----
  if test_support.verbose:
      print 'play around with seek() and read() with the built largefile'
! f = open(name, 'rb')
  expect(f.tell(), 0)
  expect(f.read(1), '\000')