diff --git a/tests/test_mtbls.py b/tests/test_mtbls.py index 3cae1c8..d2bb449 100644 --- a/tests/test_mtbls.py +++ b/tests/test_mtbls.py @@ -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):