Skip to content

Commit

Permalink
FEAT download_test_data for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jalew188 committed May 16, 2024
1 parent b7ace8c commit ab67b7e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/_run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ jobs:
shell: bash -l {0}
run: |
conda activate alpharaw
pip install matplotlib
pip install pytest nbmake==1.5.3
conda deactivate
- name: Run tests
shell: bash -l {0}
run: |
conda activate alpharaw
cd tests
python download_test_data.py
. ./run_tests.sh
conda deactivate
25 changes: 25 additions & 0 deletions tests/download_test_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import requests

def download_file(url, local_filename):
# NOTE the stream=True parameter below
with requests.get(url, stream=True) as r:
r.raise_for_status()
with open(local_filename, 'wb') as f:
for chunk in r.iter_content(chunk_size=8192):
# If you have chunk encoded response uncomment if
# and set chunk_size parameter to None.
#if chunk:
f.write(chunk)

url_template = "https://datashare.biochem.mpg.de/s/GOiZGGOhrHzS54M/download?path=%2F&files={}"
output_template = "../nbs_tests/test_data/{}"
test_files = [
"20201215_sswath_1min_5ug_1.wiff",
"20201215_sswath_1min_5ug_1.wiff.scan",
"iRT.raw",
"iRT_DIA.raw",
"multinotch.raw",
]
for test_file in test_files:
print(f"Downding {test_file}...")
download_file(url_template.format(test_file), output_template.format(test_file))

0 comments on commit ab67b7e

Please sign in to comment.