Skip to content

Commit

Permalink
Use curl for hsload test files
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjala committed Apr 1, 2024
1 parent 4804c3b commit f91431f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 0 additions & 2 deletions h5pyd/_hl/httpconn.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,6 @@ def PUT(self, req, body=None, format="json", params=None, headers=None):
headers["Content-Type"] = "application/json"
data = json.dumps(body)

# Must be explicitly specified for Windows
headers["Content-Type"] += "; charset=utf-8"
self.log.info("PUT: {} format: {} [{} bytes]".format(req, format, len(data)))

try:
Expand Down
12 changes: 9 additions & 3 deletions test/apps/load_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import sys
import config
import h5pyd

from platform import system
#
# Main
#
Expand Down Expand Up @@ -60,9 +60,15 @@
# wget from S3
http_path = test_file_http_path + filename
print("downloading:", http_path)
rc = os.system(f"wget -q https://s3.amazonaws.com/hdfgroup/data/hdf5test/{filename} -P {data_dir}")

if system() == "Windows":
get_cmd = f"curl.exe -o {filename} https://s3.amazonaws.com/hdfgroup/data/hdf5test/{filename} --create-dirs --output-dir {data_dir}"
else:
get_cmd = f"wget -q https://s3.amazonaws.com/hdfgroup/data/hdf5test/{filename} -P {data_dir}"

rc = os.system(f"{get_cmd}")
if rc != 0:
sys.exit("Failed to retreive test data file")
sys.exit(f"Failed to retreive test data file with error code {rc}")
# run hsload for each file
print(f"running hsload for {hdf5_path} to {test_folder}")
rc = os.system(f"python ../../h5pyd/_apps/hsload.py {hdf5_path} {test_folder}")
Expand Down

0 comments on commit f91431f

Please sign in to comment.