55
55
DEFAULT_SOCKET_TIMEOUT ,
56
56
smart_str ,
57
57
)
58
+ from galaxy .util .compression_utils import CompressedFile
59
+ from galaxy .util .resources import as_file
58
60
from galaxy_test .base .api_asserts import assert_status_code_is_ok
59
61
from galaxy_test .base .api_util import get_admin_api_key
60
62
from galaxy_test .base .populators import wait_on_assertion
64
66
hgweb_config ,
65
67
xml_util ,
66
68
)
67
- from tool_shed .util .repository_content_util import tar_open
68
69
from tool_shed .webapp .model import Repository as DbRepository
69
70
from tool_shed_client .schema import (
70
71
Category ,
@@ -1146,7 +1147,8 @@ def add_file_to_repository(
1146
1147
target = os .path .basename (source )
1147
1148
full_target = os .path .join (temp_directory , target )
1148
1149
full_source = TEST_DATA_REPO_FILES .joinpath (source )
1149
- shutil .copyfile (str (full_source ), full_target )
1150
+ with as_file (full_source ) as full_source_path :
1151
+ shutil .copyfile (full_source_path , full_target )
1150
1152
commit_message = commit_message or "Uploaded revision with added file."
1151
1153
self ._upload_dir_to_repository (
1152
1154
repository , temp_directory , commit_message = commit_message , strings_displayed = strings_displayed
@@ -1155,9 +1157,9 @@ def add_file_to_repository(
1155
1157
def add_tar_to_repository (self , repository : Repository , source : str , strings_displayed = None ):
1156
1158
with self .cloned_repo (repository ) as temp_directory :
1157
1159
full_source = TEST_DATA_REPO_FILES .joinpath (source )
1158
- tar = tar_open ( full_source )
1159
- tar . extractall ( path = temp_directory )
1160
- tar .close ( )
1160
+ with full_source . open ( "rb" ) as full_source_fileobj :
1161
+ with CompressedFile . open_tar ( full_source_fileobj ) as tar :
1162
+ tar .extractall ( path = temp_directory )
1161
1163
commit_message = "Uploaded revision with added files from tar."
1162
1164
self ._upload_dir_to_repository (
1163
1165
repository , temp_directory , commit_message = commit_message , strings_displayed = strings_displayed
0 commit comments