Skip to content

Commit

Permalink
add test of download for gnps2
Browse files Browse the repository at this point in the history
  • Loading branch information
CunliangGeng committed Jan 10, 2025
1 parent 418ff4c commit 408fdbf
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/unit/metabolomics/test_gnps_downloader.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import tarfile
import zipfile
import pytest
from nplinker.metabolomics.gnps import GNPSDownloader
Expand Down Expand Up @@ -111,3 +112,22 @@ def test_download_gnps1(task_id, workflow, tmpdir, gnps_zip_files, gnps_website_
expected = zipfile.ZipFile(gnps_zip_files[workflow])
expected_names = expected.namelist()
assert actual_names == expected_names


@pytest.mark.parametrize(
"task_id, workflow",
[
["2014f321d72542afb5216c932e0d5079", GNPSFormat.GNPS2FBMN],
["206a7b40b7ed41c1ae6b4fbd2def3636", GNPSFormat.GNPS2CN],
],
)
def test_download_gnps2(task_id, workflow, tmpdir, gnps2_tar_files, gnps2_website_is_down):
if gnps2_website_is_down:
pytest.skip("GNPS2 website is down: https://gnps2.org")
downloader = GNPSDownloader(task_id, tmpdir, gnps_version="2")
downloader.download()
actual = tarfile.open(downloader.get_download_file())
actual_names = actual.getnames()
expected = tarfile.open(gnps2_tar_files[workflow])
expected_names = expected.getnames()
assert actual_names == expected_names

0 comments on commit 408fdbf

Please sign in to comment.