diff options
author | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2005-12-16 20:25:58 +0000 |
---|---|---|
committer | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2005-12-16 20:25:58 +0000 |
commit | de66d93df7e024b160116409dedea240056818b5 (patch) | |
tree | 6f807c94a1f29dcc0878f4dd6d4f7e83b09ef7e7 /rdiff-backup/testing | |
parent | 895779c70dd4f6dd4c8d13b286540a4d5896b97f (diff) | |
download | rdiff-backup-de66d93df7e024b160116409dedea240056818b5.tar.gz |
Don't gzip 0 length files
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@712 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/testing')
-rw-r--r-- | rdiff-backup/testing/rpathtest.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/rdiff-backup/testing/rpathtest.py b/rdiff-backup/testing/rpathtest.py index 6d7dee2..9db7f2e 100644 --- a/rdiff-backup/testing/rpathtest.py +++ b/rdiff-backup/testing/rpathtest.py @@ -454,5 +454,33 @@ class CheckPath(unittest.TestCase): bin2 = RPath(Globals.local_connection, "/bin") assert bin.path == "/bin", bin2.path +class Gzip(RPathTest): + """Test the gzip related functions/classes""" + def test_maybe_gzip(self): + """Test MaybeGzip""" + dirrp = rpath.RPath(self.lc, "testfiles/output") + re_init_dir(dirrp) + + base_rp = dirrp.append('foo') + fileobj = rpath.MaybeGzip(base_rp) + fileobj.close() + base_rp.setdata() + assert base_rp.isreg(), base_rp + assert base_rp.getsize() == 0 + base_rp.delete() + + base_gz = dirrp.append('foo.gz') + assert not base_gz.lstat() + fileobj = rpath.MaybeGzip(base_rp) + fileobj.write("lala") + fileobj.close() + base_rp.setdata() + base_gz.setdata() + assert not base_rp.lstat() + assert base_gz.isreg(), base_gz + data = base_gz.get_data(compressed = 1) + assert data == "lala", data + + if __name__ == "__main__": unittest.main() |