예제 #1
0
 def test_gzip_on_remote(self):
     local_gzip = os.path.join(os.path.dirname(__file__),
                               'file_data/s_3_2126.bcl.gz')
     remote_gzip = stor.join(self.test_dir, stor.basename(local_gzip))
     stor.copy(local_gzip, remote_gzip)
     with stor.open(remote_gzip) as fp:
         with gzip.GzipFile(fileobj=fp) as remote_gzip_fp:
             with gzip.open(local_gzip) as local_gzip_fp:
                 assert_same_data(remote_gzip_fp, local_gzip_fp)
예제 #2
0
 def test_copy_to_from_dir(self):
     num_test_objs = 5
     min_obj_size = 100
     with NamedTemporaryDirectory(change_dir=True) as tmp_d:
         self.create_dataset(tmp_d, num_test_objs, min_obj_size)
         for which_obj in self.get_dataset_obj_names(num_test_objs):
             obj_path = stor.join(self.test_dir, '%s.txt' % which_obj)
             stor.copy(which_obj, obj_path)
             stor.copy(obj_path, 'copied_file')
             self.assertCorrectObjectContents('copied_file', which_obj,
                                              min_obj_size)
예제 #3
0
 def test_copy_to_from_dir(self):
     num_test_objs = 5
     min_obj_size = 100
     with NamedTemporaryDirectory(change_dir=True) as tmp_d:
         self.create_dataset(tmp_d, num_test_objs, min_obj_size)
         for which_obj in self.get_dataset_obj_names(num_test_objs):
             obj_path = stor.join(self.test_dir, '%s.txt' % which_obj)
             stor.copy(which_obj, obj_path)
             file_h = dxpy.DXFile(dxid=obj_path.canonical_resource,
                                  project=obj_path.canonical_project)
             file_h.wait_on_close(20)  # wait for file to go to closed state
             stor.copy(obj_path, 'copied_file')
             self.assertCorrectObjectContents('copied_file', which_obj,
                                              min_obj_size)
예제 #4
0
    def test_gzip_on_remote(self):
        self._skip_if_filesystem_python3(self.test_dir)
        local_gzip = os.path.join(os.path.dirname(__file__),
                                  'file_data/s_3_2126.bcl.gz')
        remote_gzip = stor.join(self.test_dir, stor.basename(local_gzip))
        stor.copy(local_gzip, remote_gzip)
        file_h = dxpy.DXFile(dxid=remote_gzip.canonical_resource,
                             project=remote_gzip.canonical_project)
        file_h.wait_on_close(20)  # wait for file to go to closed state

        with stor.open(remote_gzip, mode='rb') as fp:
            with gzip.GzipFile(fileobj=fp) as remote_gzip_fp:
                with gzip.open(local_gzip) as local_gzip_fp:
                    assert_same_data(remote_gzip_fp, local_gzip_fp)