File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 9
9
import shutil
10
10
import stat
11
11
import sys
12
+ import zipfile
12
13
from datetime import datetime
13
14
14
15
import pytest
@@ -1123,3 +1124,25 @@ def test_compress_append_archive_w_zerofile(tmp_path):
1123
1124
#
1124
1125
with py7zr .SevenZipFile (target , "r" ) as arc :
1125
1126
arc .extractall (path = tmp_path / "tgt" )
1127
+
1128
+
1129
+ @pytest .mark .basic
1130
+ def test_compress_file_append_dir (tmp_path ):
1131
+ srcpath = tmp_path .joinpath ("src" )
1132
+ srcpath .mkdir ()
1133
+ with zipfile .ZipFile (pathlib .Path (testdata_path ).joinpath ("github_404.zip" )) as zipsrc :
1134
+ zipsrc .extractall (path = srcpath )
1135
+ target = tmp_path .joinpath ("target.7z" )
1136
+ with py7zr .SevenZipFile (target , "w" ) as archive :
1137
+ archive .write (srcpath .joinpath ("a.xlsx" ), arcname = "a.xlsx" )
1138
+ archive = py7zr .SevenZipFile (target , "a" )
1139
+ archive .set_encoded_header_mode (False )
1140
+ archive .writeall (srcpath .joinpath ("22" ), arcname = "22" )
1141
+ assert len (archive .files .files_list ) == 8
1142
+ archive .close ()
1143
+ #
1144
+ p7zip_test (target )
1145
+ libarchive_extract (target , tmp_path .joinpath ("tgt2" ))
1146
+ #
1147
+ with py7zr .SevenZipFile (target , "r" ) as arc :
1148
+ arc .extractall (path = tmp_path / "tgt" )
You can’t perform that action at this time.
0 commit comments