Skip to content

Commit

Permalink
Skip MetaboLights tests when file extensions cannot be downloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
althonos committed Nov 6, 2023
1 parent 5e8ae9e commit b6794aa
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tests/test_mtbls.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ def tearDownClass(cls):
def get_concerned_studies(cls):
study_exts = six.BytesIO()

with contextlib.closing(ftplib.FTP("ftp.ebi.ac.uk")) as ebi_ftp:
ebi_ftp.login()
ebi_ftp.cwd("/pub/databases/metabolights/study_file_extensions")
ebi_ftp.retrbinary("RETR ml_file_extension.json", study_exts.write)

stats = json.loads(study_exts.getvalue().decode('utf-8'))
return [s['id'] for s in stats if '.nmrML' in s['extensions']]
try:
with contextlib.closing(ftplib.FTP("ftp.ebi.ac.uk")) as ebi_ftp:
ebi_ftp.login()
ebi_ftp.cwd("/pub/databases/metabolights/study_file_extensions")
ebi_ftp.retrbinary("RETR ml_file_extension.json", study_exts.write)
except:
return []
else:
stats = json.loads(study_exts.getvalue().decode('utf-8'))
return [s['id'] for s in stats if '.nmrML' in s['extensions']]

@classmethod
def register_tests(cls):
Expand Down

0 comments on commit b6794aa

Please sign in to comment.