示例#1
0
    def test_sync_to_dir_local(self):
        path = os.path.join(self.tmp_dir.name, 'lorem', 'ipsum.txt')
        src = os.path.dirname(path)
        dst = os.path.join(self.tmp_dir.name, 'xxx')
        make_dir(src, check_empty=False)
        make_dir(dst, check_empty=False)

        fs = FileSystem.get_file_system(path, 'r')
        fs.write_bytes(path, bytes([0x00, 0x01]))
        sync_to_dir(src, dst, delete=True)

        self.assertEqual(len(list_paths(dst)), 1)
示例#2
0
 def sync_to_cloud(self):
     """Sync any output to the cloud at output_uri."""
     if self.cfg.output_uri.startswith('s3://'):
         sync_to_dir(self.output_dir, self.cfg.output_uri)
示例#3
0
 def test_sync_to_http(self):
     src = self.tmp_dir.name
     dst = 'http://localhost/'
     self.assertRaises(NotWritableError, lambda: sync_to_dir(src, dst))