diff options
Diffstat (limited to 'Lib/test/test_largefile.py')
-rw-r--r-- | Lib/test/test_largefile.py | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/Lib/test/test_largefile.py b/Lib/test/test_largefile.py index b2bec1fa9f..407aba81e0 100644 --- a/Lib/test/test_largefile.py +++ b/Lib/test/test_largefile.py @@ -11,25 +11,6 @@ import test_support import os, struct, stat, sys -# only run if the current system support large files -f = open(test_support.TESTFN, 'wb') -try: - # 2**31 == 2147483648 - f.seek(2147483649L) -except (IOError, OverflowError): - f.close() - os.unlink(test_support.TESTFN) - raise test_support.TestSkipped, \ - "platform does not have largefile support" -else: - f.close() - - -# create >2GB file (2GB = 2147483648 bytes) -size = 2500000000L -name = test_support.TESTFN - - # On Windows this test comsumes large resources; It takes a long time to build # the >2GB file and takes >2GB of disk space therefore the resource must be # enabled to run this test. If not, nothing after this line stanza will be @@ -38,6 +19,28 @@ if sys.platform[:3] == 'win': test_support.requires( 'largefile', 'test requires %s bytes and a long time to run' % str(size)) +else: + # Only run if the current filesystem supports large files. + # (Skip this test on Windows, since we now always support large files.) + f = open(test_support.TESTFN, 'wb') + try: + # 2**31 == 2147483648 + f.seek(2147483649L) + # Seeking is not enough of a test: you must write and flush, too! + f.write("x") + f.flush() + except (IOError, OverflowError): + f.close() + os.unlink(test_support.TESTFN) + raise test_support.TestSkipped, \ + "filesystem does not have largefile support" + else: + f.close() + + +# create >2GB file (2GB = 2147483648 bytes) +size = 2500000000L +name = test_support.TESTFN def expect(got_this, expect_this): |