Back to index

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

Classes

class  ReadTest
class  UstarReadTest
class  CommonReadTest
class  MiscReadTest
class  StreamReadTest
class  DetectReadTest
class  MemberReadTest
class  LongnameTest
class  GNUReadTest
class  PaxReadTest
class  WriteTestBase
class  WriteTest
class  StreamWriteTest
class  GNUWriteTest
class  HardlinkTest
class  PaxWriteTest
class  UstarUnicodeTest
class  GNUUnicodeTest
class  PAXUnicodeTest
class  AppendTest
class  LimitsTest
class  MiscTest
class  ContextManagerTest
class  LinkEmulationTest
class  GzipMiscReadTest
class  GzipUstarReadTest
class  GzipStreamReadTest
class  GzipWriteTest
class  GzipStreamWriteTest
class  Bz2MiscReadTest
class  Bz2UstarReadTest
class  Bz2StreamReadTest
class  Bz2WriteTest
class  Bz2StreamWriteTest
class  Bz2PartialReadTest

Functions

def md5sum
def test_main

Variables

 gzip = None
 bz2 = None
tuple TEMPDIR = os.path.abspath(support.TESTFN)
tuple tarname = support.findfile("testtar.tar")
tuple gzipname = os.path.join(TEMPDIR, "testtar.tar.gz")
tuple bz2name = os.path.join(TEMPDIR, "testtar.tar.bz2")
tuple tmpname = os.path.join(TEMPDIR, "tmp.tar")
string md5_regtype = "65f477c818ad9e15f7feab0c6d37742f"
string md5_sparse = "a54fbc4ca4f4399a90e1b27164012fc6"

Function Documentation

def test.test_tarfile.md5sum (   data)

Definition at line 25 of file test_tarfile.py.

00025 
00026 def md5sum(data):
00027     return md5(data).hexdigest()

Definition at line 1749 of file test_tarfile.py.

01749 
01750 def test_main():
01751     support.unlink(TEMPDIR)
01752     os.makedirs(TEMPDIR)
01753 
01754     tests = [
01755         UstarReadTest,
01756         MiscReadTest,
01757         StreamReadTest,
01758         DetectReadTest,
01759         MemberReadTest,
01760         GNUReadTest,
01761         PaxReadTest,
01762         WriteTest,
01763         StreamWriteTest,
01764         GNUWriteTest,
01765         PaxWriteTest,
01766         UstarUnicodeTest,
01767         GNUUnicodeTest,
01768         PAXUnicodeTest,
01769         AppendTest,
01770         LimitsTest,
01771         MiscTest,
01772         ContextManagerTest,
01773     ]
01774 
01775     if hasattr(os, "link"):
01776         tests.append(HardlinkTest)
01777     else:
01778         tests.append(LinkEmulationTest)
01779 
01780     with open(tarname, "rb") as fobj:
01781         data = fobj.read()
01782 
01783     if gzip:
01784         # Create testtar.tar.gz and add gzip-specific tests.
01785         support.unlink(gzipname)
01786         with gzip.open(gzipname, "wb") as tar:
01787             tar.write(data)
01788 
01789         tests += [
01790             GzipMiscReadTest,
01791             GzipUstarReadTest,
01792             GzipStreamReadTest,
01793             GzipWriteTest,
01794             GzipStreamWriteTest,
01795         ]
01796 
01797     if bz2:
01798         # Create testtar.tar.bz2 and add bz2-specific tests.
01799         support.unlink(bz2name)
01800         tar = bz2.BZ2File(bz2name, "wb")
01801         try:
01802             tar.write(data)
01803         finally:
01804             tar.close()
01805 
01806         tests += [
01807             Bz2MiscReadTest,
01808             Bz2UstarReadTest,
01809             Bz2StreamReadTest,
01810             Bz2WriteTest,
01811             Bz2StreamWriteTest,
01812             Bz2PartialReadTest,
01813         ]
01814 
01815     try:
01816         support.run_unittest(*tests)
01817     finally:
01818         if os.path.exists(TEMPDIR):
01819             shutil.rmtree(TEMPDIR)

Here is the call graph for this function:


Variable Documentation

Definition at line 23 of file test_tarfile.py.

tuple test.test_tarfile.bz2name = os.path.join(TEMPDIR, "testtar.tar.bz2")

Definition at line 31 of file test_tarfile.py.

Definition at line 19 of file test_tarfile.py.

tuple test.test_tarfile.gzipname = os.path.join(TEMPDIR, "testtar.tar.gz")

Definition at line 30 of file test_tarfile.py.

string test.test_tarfile.md5_regtype = "65f477c818ad9e15f7feab0c6d37742f"

Definition at line 34 of file test_tarfile.py.

string test.test_tarfile.md5_sparse = "a54fbc4ca4f4399a90e1b27164012fc6"

Definition at line 35 of file test_tarfile.py.

Definition at line 29 of file test_tarfile.py.

tuple test.test_tarfile.TEMPDIR = os.path.abspath(support.TESTFN)

Definition at line 28 of file test_tarfile.py.

Definition at line 32 of file test_tarfile.py.