From 0c361a33a9a4b009b3ada9dd88ccef43e299ed65 Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 25 Mar 2002 07:52:04 +0000 Subject: Added testcases for gzipped increments, fixed some increment test cases. git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@24 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/testing/rpathtest.py | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'rdiff-backup/testing/rpathtest.py') diff --git a/rdiff-backup/testing/rpathtest.py b/rdiff-backup/testing/rpathtest.py index 0b28f14..9a24e6c 100644 --- a/rdiff-backup/testing/rpathtest.py +++ b/rdiff-backup/testing/rpathtest.py @@ -225,6 +225,47 @@ class FileIO(RPathTest): fp_input.close() rp.delete() + def testGzipWrite(self): + """Test writing of gzipped files""" + try: os.mkdir("testfiles/output") + except OSError: pass + rp_gz = RPath(self.lc, "testfiles/output/file.gz") + rp = RPath(self.lc, "testfiles/output/file") + if rp.lstat(): rp.delete() + s = "Hello, world!" + + fp_out = rp_gz.open("wb", compress = 1) + fp_out.write(s) + assert not fp_out.close() + assert not os.system("gunzip testfiles/output/file.gz") + fp_in = rp.open("rb") + assert fp_in.read() == s + fp_in.close() + + def testGzipRead(self): + """Test reading of gzipped files""" + try: os.mkdir("testfiles/output") + except OSError: pass + rp_gz = RPath(self.lc, "testfiles/output/file.gz") + if rp_gz.lstat(): rp_gz.delete() + rp = RPath(self.lc, "testfiles/output/file") + s = "Hello, world!" + + fp_out = rp.open("wb") + fp_out.write(s) + assert not fp_out.close() + rp.setdata() + assert rp.lstat() + + assert not os.system("gzip testfiles/output/file") + rp.setdata() + rp_gz.setdata() + assert not rp.lstat() + assert rp_gz.lstat() + fp_in = rp_gz.open("rb", compress = 1) + assert fp_in.read() == s + assert not fp_in.close() + class FileCopying(RPathTest): """Test file copying and comparison""" -- cgit v1.2.1