From b510d8124055e1736485fdc76c4e74e70482b45c Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Wed, 18 Dec 2024 11:17:56 -0800 Subject: [PATCH] remove tests for bad zip files :sweat_smile: --- src/python/tests/test_fastgather.py | 34 --------------- src/python/tests/test_fastmultigather.py | 55 ------------------------ src/python/tests/test_index.py | 21 --------- src/python/tests/test_manysearch.py | 27 ------------ src/python/tests/test_multisearch.py | 27 ------------ src/python/tests/test_pairwise.py | 23 ---------- 6 files changed, 187 deletions(-) diff --git a/src/python/tests/test_fastgather.py b/src/python/tests/test_fastgather.py index e3ab4255..2fb1ed78 100644 --- a/src/python/tests/test_fastgather.py +++ b/src/python/tests/test_fastgather.py @@ -427,40 +427,6 @@ def test_bad_against_2(runtmp, capfd): ) -def test_bad_against_3(runtmp, capfd): - # test with a bad against (a .sig.gz file renamed as zip file) - query = get_test_data("SRR606249.sig.gz") - - sig2 = get_test_data("2.fa.sig.gz") - against_zip = runtmp.output("against.zip") - # cp sig2 into against_zip - with open(against_zip, "wb") as fp: - with open(sig2, "rb") as fp2: - fp.write(fp2.read()) - - g_output = runtmp.output("gather.csv") - p_output = runtmp.output("prefetch.csv") - - with pytest.raises(utils.SourmashCommandFailed): - runtmp.sourmash( - "scripts", - "fastgather", - query, - against_zip, - "-o", - g_output, - "--output-prefetch", - p_output, - "-s", - "100000", - ) - - captured = capfd.readouterr() - print(captured.err) - - assert "InvalidArchive" in captured.err - - @pytest.mark.xfail(reason="should work, bug") def test_against_multisigfile(runtmp, zip_against): # test against a sigfile that contains multiple sketches diff --git a/src/python/tests/test_fastmultigather.py b/src/python/tests/test_fastmultigather.py index 9d9c17e7..d47f62ad 100644 --- a/src/python/tests/test_fastmultigather.py +++ b/src/python/tests/test_fastmultigather.py @@ -561,34 +561,6 @@ def test_sig_query(runtmp, capfd, indexed): }.issubset(keys) -def test_bad_query(runtmp, capfd, indexed): - # test with a bad query (a .sig.gz file renamed as zip file) - against_list = runtmp.output("against.txt") - - sig2 = get_test_data("2.fa.sig.gz") - sig47 = get_test_data("47.fa.sig.gz") - sig63 = get_test_data("63.fa.sig.gz") - - query_zip = runtmp.output("query.zip") - # cp sig2 into query_zip - with open(query_zip, "wb") as fp: - with open(sig2, "rb") as fp2: - fp.write(fp2.read()) - - make_file_list(against_list, [sig2, sig47, sig63]) - - if indexed: - against_list = index_siglist(runtmp, against_list, runtmp.output("db")) - - with pytest.raises(utils.SourmashCommandFailed): - runtmp.sourmash("scripts", "fastmultigather", query_zip, against_list) - - captured = capfd.readouterr() - print(captured.err) - - assert "InvalidArchive" in captured.err - - def test_missing_query(runtmp, capfd, indexed): # test missing query query_list = runtmp.output("query.txt") @@ -736,33 +708,6 @@ def test_bad_against(runtmp, capfd): ) -def test_bad_against_2(runtmp, capfd, zip_query): - # test with a bad against (a .sig.gz file renamed as zip file) - query = get_test_data("SRR606249.sig.gz") - query_list = runtmp.output("query.txt") - make_file_list(query_list, [query]) - - sig2 = get_test_data("2.fa.sig.gz") - against_zip = runtmp.output("against.zip") - # cp sig2 into query_zip - with open(against_zip, "wb") as fp: - with open(sig2, "rb") as fp2: - fp.write(fp2.read()) - - if zip_query: - query_list = zip_siglist(runtmp, query_list, runtmp.output("query.zip")) - - with pytest.raises(utils.SourmashCommandFailed): - runtmp.sourmash( - "scripts", "fastmultigather", query_list, against_zip, "-s", "100000" - ) - - captured = capfd.readouterr() - print(captured.err) - - assert "InvalidArchive" in captured.err - - def test_empty_against(runtmp, capfd): # test bad 'against' file - in this case, an empty one query = get_test_data("SRR606249.sig.gz") diff --git a/src/python/tests/test_index.py b/src/python/tests/test_index.py index 72d40bee..4d7a5f04 100644 --- a/src/python/tests/test_index.py +++ b/src/python/tests/test_index.py @@ -429,27 +429,6 @@ def test_index_zipfile_multiparam(runtmp, capfd, toggle_internal_storage): runtmp.sourmash("scripts", "index", zipf, "-o", output, toggle_internal_storage) -def test_index_zipfile_bad(runtmp, capfd): - # test with a bad input zipfile (a .sig.gz file renamed as zip file) - sig2 = get_test_data("2.fa.sig.gz") - - query_zip = runtmp.output("query.zip") - # cp sig2 into query_zip - with open(query_zip, "wb") as fp: - with open(sig2, "rb") as fp2: - fp.write(fp2.read()) - - output = runtmp.output("out.csv") - - with pytest.raises(utils.SourmashCommandFailed): - runtmp.sourmash("scripts", "index", query_zip, "-o", output) - - captured = capfd.readouterr() - print(captured.err) - - assert "Couldn't find End Of Central Directory Record" in captured.err - - def test_index_check(runtmp, toggle_internal_storage): # test check index siglist = runtmp.output("db-sigs.txt") diff --git a/src/python/tests/test_manysearch.py b/src/python/tests/test_manysearch.py index 6275b0cf..0e84fb00 100644 --- a/src/python/tests/test_manysearch.py +++ b/src/python/tests/test_manysearch.py @@ -556,33 +556,6 @@ def test_bad_query_2(runtmp, capfd, indexed): ) -def test_bad_query_3(runtmp, capfd): - # test with a bad query (a .sig.gz file renamed as zip file) - against_list = runtmp.output("against.txt") - - sig2 = get_test_data("2.fa.sig.gz") - sig47 = get_test_data("47.fa.sig.gz") - sig63 = get_test_data("63.fa.sig.gz") - - query_zip = runtmp.output("query.zip") - # cp sig2 into query_zip - with open(query_zip, "wb") as fp: - with open(sig2, "rb") as fp2: - fp.write(fp2.read()) - - make_file_list(against_list, [sig2, sig47, sig63]) - - output = runtmp.output("out.csv") - - with pytest.raises(utils.SourmashCommandFailed): - runtmp.sourmash("scripts", "multisearch", query_zip, against_list, "-o", output) - - captured = capfd.readouterr() - print(captured.err) - - assert "InvalidArchive" in captured.err - - def test_missing_against(runtmp, capfd, indexed): # test with a missing against list query_list = runtmp.output("query.txt") diff --git a/src/python/tests/test_multisearch.py b/src/python/tests/test_multisearch.py index dfc65ee2..3be64fed 100644 --- a/src/python/tests/test_multisearch.py +++ b/src/python/tests/test_multisearch.py @@ -628,33 +628,6 @@ def test_bad_query(runtmp, capfd): ) -def test_bad_query_3(runtmp, capfd): - # test with a bad query (a .sig.gz file renamed as zip file) - against_list = runtmp.output("against.txt") - - sig2 = get_test_data("2.fa.sig.gz") - sig47 = get_test_data("47.fa.sig.gz") - sig63 = get_test_data("63.fa.sig.gz") - - query_zip = runtmp.output("query.zip") - # cp sig2 into query_zip - with open(query_zip, "wb") as fp: - with open(sig2, "rb") as fp2: - fp.write(fp2.read()) - - make_file_list(against_list, [sig2, sig47, sig63]) - - output = runtmp.output("out.csv") - - with pytest.raises(utils.SourmashCommandFailed): - runtmp.sourmash("scripts", "multisearch", query_zip, against_list, "-o", output) - - captured = capfd.readouterr() - print(captured.err) - - assert "InvalidArchive" in captured.err - - def test_missing_against(runtmp, capfd, zip_db): # test with a missing against list query_list = runtmp.output("query.txt") diff --git a/src/python/tests/test_pairwise.py b/src/python/tests/test_pairwise.py index 1a940043..c4021239 100644 --- a/src/python/tests/test_pairwise.py +++ b/src/python/tests/test_pairwise.py @@ -230,29 +230,6 @@ def test_bad_query(runtmp, capfd): ) -def test_bad_query_2(runtmp, capfd): - # test with a bad query (a .sig.gz file renamed as zip file) - sig2 = get_test_data("2.fa.sig.gz") - sig47 = get_test_data("47.fa.sig.gz") - sig63 = get_test_data("63.fa.sig.gz") - - query_zip = runtmp.output("query.zip") - # cp sig2 into query_zip - with open(query_zip, "wb") as fp: - with open(sig2, "rb") as fp2: - fp.write(fp2.read()) - - output = runtmp.output("out.csv") - - with pytest.raises(utils.SourmashCommandFailed): - runtmp.sourmash("scripts", "pairwise", query_zip, "-o", output) - - captured = capfd.readouterr() - print(captured.err) - - assert "InvalidArchive" in captured.err - - def test_missing_query(runtmp, capfd, zip_db): # test with a missing query list query_list = runtmp.output("query.txt")