| 130 | io.remove(oss_file_path2) |
| 131 | |
| 132 | def test_copytree_multi_dirs(self): |
| 133 | target = [ |
| 134 | 'dir1/a.txt', 'dir1/dir1_1/a.txt', 'dir1/dir1_1/b.txt', |
| 135 | 'dir2/b.txt' |
| 136 | ] |
| 137 | # test copy dir from oss to local |
| 138 | oss_file_path1 = IO_DATA_MULTI_DIRS_OSS |
| 139 | temp_dir = tempfile.TemporaryDirectory().name |
| 140 | io.copytree(oss_file_path1, temp_dir) |
| 141 | self.assertTrue(io.exists(temp_dir)) |
| 142 | self.assertCountEqual(io.listdir(temp_dir, recursive=True), target) |
| 143 | |
| 144 | # test copy dir from local to oss |
| 145 | oss_file_path2 = os.path.join(TMP_DIR_OSS, '%s' % uuid.uuid4().hex) |
| 146 | io.copytree(temp_dir, oss_file_path2) |
| 147 | self.assertTrue(io.exists(oss_file_path2)) |
| 148 | self.assertCountEqual( |
| 149 | io.listdir(oss_file_path2, recursive=True), target) |
| 150 | |
| 151 | io.remove(temp_dir) |
| 152 | io.remove(oss_file_path2) |
| 153 | |
| 154 | def test_listdir(self): |
| 155 | # with suffix / |