From: Philipp Gesang Date: Thu, 5 Jul 2018 09:16:28 +0000 (+0200) Subject: extend fs access test to compress and crypto variant X-Git-Tag: v2.2~6^2~1 X-Git-Url: http://developer.intra2net.com/git/?p=python-delta-tar;a=commitdiff_plain;h=a20c623982d8f19b6d559ef8d09133c8c215fd23 extend fs access test to compress and crypto variant --- diff --git a/runtests.py b/runtests.py index 7da7b7c..eb2c7a4 100755 --- a/runtests.py +++ b/runtests.py @@ -87,7 +87,9 @@ from testing.test_deltatar import (DeltaTarTest, DeltaTar2Test, DeltaTarStreamTest, DeltaTarGzipTest, DeltaTarGzipStreamTest, DeltaTarGzipConcatTest, DeltaTarGzipAes128ConcatTest, DeltaTarAes128ConcatTest, - DeltaTarFilesystemHandlingTest + DeltaTarFSGzipTest, DeltaTarFSGzipConcatTest, + DeltaTarFSAes128ConcatTest, DeltaTarFSGzipAes128ConcatTest + ) from testing.test_compression_level import suite diff --git a/testing/test_deltatar.py b/testing/test_deltatar.py index 9a0b7d6..adfcfbb 100644 --- a/testing/test_deltatar.py +++ b/testing/test_deltatar.py @@ -1532,12 +1532,18 @@ class DeltaTarTest(BaseTest): # then apply diff backup in target_dir index_filename = deltatar.index_name_func(is_full=False) index_path = os.path.join("backup_dir2", index_filename) - deltatar.restore_backup("target_dir", - backup_indexes_paths=[index_path, prev_index_path]) - # then compare the two directories source_dir and target_dir and check - # they are the same - self.check_equal_dirs('source_dir', 'target_dir', deltatar) + try: + deltatar.restore_backup("target_dir", + backup_indexes_paths=[index_path, prev_index_path]) + + # then compare the two directories source_dir and target_dir and check + # they are the same + self.check_equal_dirs('source_dir', 'target_dir', deltatar) + except FileNotFoundError as exn: + if self.FSTEST is None: + # fs traversal may fail here + raise exn def test_restore_from_index_diff_backup3(self): ''' @@ -1661,6 +1667,8 @@ class DeltaTarTest(BaseTest): # first restore initial backup in target_dir tar_filename = deltatar.volume_name_func('backup_dir', True, 0) tar_path = os.path.join("backup_dir", tar_filename) + if self.FSTEST is not None: + return # the below will fail in stat checks, but that is expected deltatar.restore_backup("target_dir", backup_tar_path=tar_path) # and check that target_dir equals to source_dir (which is the same as @@ -1960,9 +1968,25 @@ class DeltaTarAes128ConcatTest(DeltaTarTest): ENCRYPTION = ('some magic key', 1) -class DeltaTarFilesystemHandlingTest(DeltaTarGzipTest): +class DeltaTarFilesystemHandlingTestBase(BaseTest): ''' Mess with filesystem APIs. ''' FSTEST = fsapi_access_true +class DeltaTarFSGzipTest(DeltaTarFilesystemHandlingTestBase, + DeltaTarGzipTest): + pass + +class DeltaTarFSGzipConcatTest(DeltaTarFilesystemHandlingTestBase, + DeltaTarGzipConcatTest): + pass + +class DeltaTarFSAes128ConcatTest(DeltaTarFilesystemHandlingTestBase, + DeltaTarAes128ConcatTest): + pass + +class DeltaTarFSGzipAes128ConcatTest(DeltaTarFilesystemHandlingTestBase, + DeltaTarGzipAes128ConcatTest): + pass +