Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.test_largefile Namespace Reference

Classes

class  LargeFileTest

Functions

def test_main

Variables

tuple oldhandler = signal.signal(signal.SIGXFSZ, signal.SIG_IGN)
int size = 2500000000

Detailed Description

Test largefile support on system where this makes sense.

Function Documentation

Definition at line 145 of file test_largefile.py.

00145 
00146 def test_main():
00147     # On Windows and Mac OSX this test comsumes large resources; It
00148     # takes a long time to build the >2GB file and takes >2GB of disk
00149     # space therefore the resource must be enabled to run this test.
00150     # If not, nothing after this line stanza will be executed.
00151     if sys.platform[:3] == 'win' or sys.platform == 'darwin':
00152         requires('largefile',
00153                  'test requires %s bytes and a long time to run' % str(size))
00154     else:
00155         # Only run if the current filesystem supports large files.
00156         # (Skip this test on Windows, since we now always support
00157         # large files.)
00158         f = open(TESTFN, 'wb', buffering=0)
00159         try:
00160             # 2**31 == 2147483648
00161             f.seek(2147483649)
00162             # Seeking is not enough of a test: you must write and
00163             # flush, too!
00164             f.write(b'x')
00165             f.flush()
00166         except (IOError, OverflowError):
00167             f.close()
00168             unlink(TESTFN)
00169             raise unittest.SkipTest("filesystem does not have largefile support")
00170         else:
00171             f.close()
00172     suite = unittest.TestSuite()
00173     for _open, prefix in [(io.open, 'C'), (pyio.open, 'Py')]:
00174         class TestCase(LargeFileTest):
00175             pass
00176         TestCase.open = staticmethod(_open)
00177         TestCase.__name__ = prefix + LargeFileTest.__name__
00178         suite.addTest(TestCase('test_seek'))
00179         suite.addTest(TestCase('test_osstat'))
00180         suite.addTest(TestCase('test_seek_read'))
00181         suite.addTest(TestCase('test_lseek'))
00182         with _open(TESTFN, 'wb') as f:
00183             if hasattr(f, 'truncate'):
00184                 suite.addTest(TestCase('test_truncate'))
00185         suite.addTest(TestCase('test_seekable'))
00186         unlink(TESTFN)
00187     try:
00188         run_unittest(suite)
00189     finally:
00190         unlink(TESTFN)

Here is the call graph for this function:


Variable Documentation

tuple test.test_largefile.oldhandler = signal.signal(signal.SIGXFSZ, signal.SIG_IGN)

Definition at line 18 of file test_largefile.py.

Definition at line 23 of file test_largefile.py.