Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_zipfile64.TestsWithSourceFile Class Reference

List of all members.

Public Member Functions

def setUp
def zipTest
def testStored
def testDeflated
def tearDown

Public Attributes

 data

Detailed Description

Definition at line 34 of file test_zipfile64.py.


Member Function Documentation

Definition at line 35 of file test_zipfile64.py.

00035 
00036     def setUp(self):
00037         # Create test data.
00038         line_gen = ("Test of zipfile line %d." % i for i in range(1000000))
00039         self.data = '\n'.join(line_gen).encode('ascii')
00040 
00041         # And write it to a file.
00042         fp = open(TESTFN, "wb")
00043         fp.write(self.data)
00044         fp.close()

Here is the caller graph for this function:

Definition at line 91 of file test_zipfile64.py.

00091 
00092     def tearDown(self):
00093         for fname in TESTFN, TESTFN2:
00094             if os.path.exists(fname):
00095                 os.remove(fname)
00096 

Here is the caller graph for this function:

Definition at line 85 of file test_zipfile64.py.

00085 
00086         def testDeflated(self):
00087             # Try the temp file first.  If we do TESTFN2 first, then it hogs
00088             # gigabytes of disk space for the duration of the test.
00089             for f in TemporaryFile(), TESTFN2:
00090                 self.zipTest(f, zipfile.ZIP_DEFLATED)

Here is the call graph for this function:

Definition at line 78 of file test_zipfile64.py.

00078 
00079     def testStored(self):
00080         # Try the temp file first.  If we do TESTFN2 first, then it hogs
00081         # gigabytes of disk space for the duration of the test.
00082         for f in TemporaryFile(), TESTFN2:
00083             self.zipTest(f, zipfile.ZIP_STORED)

Here is the call graph for this function:

def test.test_zipfile64.TestsWithSourceFile.zipTest (   self,
  f,
  compression 
)

Definition at line 45 of file test_zipfile64.py.

00045 
00046     def zipTest(self, f, compression):
00047         # Create the ZIP archive.
00048         zipfp = zipfile.ZipFile(f, "w", compression, allowZip64=True)
00049 
00050         # It will contain enough copies of self.data to reach about 6GB of
00051         # raw data to store.
00052         filecount = 6*1024**3 // len(self.data)
00053 
00054         next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
00055         for num in range(filecount):
00056             zipfp.writestr("testfn%d" % num, self.data)
00057             # Print still working message since this test can be really slow
00058             if next_time <= time.time():
00059                 next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
00060                 print((
00061                    '  zipTest still writing %d of %d, be patient...' %
00062                    (num, filecount)), file=sys.__stdout__)
00063                 sys.__stdout__.flush()
00064         zipfp.close()
00065 
00066         # Read the ZIP archive
00067         zipfp = zipfile.ZipFile(f, "r", compression)
00068         for num in range(filecount):
00069             self.assertEqual(zipfp.read("testfn%d" % num), self.data)
00070             # Print still working message since this test can be really slow
00071             if next_time <= time.time():
00072                 next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
00073                 print((
00074                    '  zipTest still reading %d of %d, be patient...' %
00075                    (num, filecount)), file=sys.__stdout__)
00076                 sys.__stdout__.flush()
00077         zipfp.close()

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 38 of file test_zipfile64.py.


The documentation for this class was generated from the following file: