Skip to content

Commit

Permalink
clean up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegenes committed Feb 10, 2024
1 parent 970c434 commit 4169e50
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 37 deletions.
10 changes: 2 additions & 8 deletions src/python/tests/test_gather.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def test_simple(runtmp, zip_against):
assert keys == {'query_filename', 'query_name', 'query_md5', 'match_name', 'match_md5', 'rank', 'intersect_bp'}



@pytest.mark.parametrize('zip_against', [False, True])
def test_simple_with_prefetch(runtmp, zip_against):
# test basic execution!
Expand Down Expand Up @@ -135,7 +134,7 @@ def test_bad_query(runtmp, capfd, zip_against):

# query doesn't need to be a sig anymore - sig, zip, or pathlist welcome
# as long as there's only one sketch that matches params
make_file_list(query, [sig2,sig47]) # [sig2]
make_file_list(query, [sig2,sig47])
make_file_list(against_list, [sig2, sig47, sig63])

if zip_against:
Expand All @@ -161,11 +160,7 @@ def test_missing_against(runtmp, capfd, zip_against):
query = get_test_data('SRR606249.sig.gz')
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')

#make_file_list(against_list, [sig2, sig47, sig63])
# don't make against list
if zip_against:
against_list = runtmp.output('against.zip')

Expand Down Expand Up @@ -207,7 +202,6 @@ def test_sig_against(runtmp, capfd):
assert keys == {'query_filename', 'query_name', 'query_md5', 'match_name', 'match_md5', 'rank', 'intersect_bp'}



def test_bad_against(runtmp, capfd):
# test bad 'against' file - in this case, one containing a bad filename.
query = get_test_data('SRR606249.sig.gz')
Expand Down
1 change: 0 additions & 1 deletion src/python/tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ def test_index_zipfile_repeated_md5sums(runtmp, capfd):
captured = capfd.readouterr()
print(captured.err)

# assert 'Found 3 filepaths' in captured.err
assert 'index is done' in runtmp.last_result.err


Expand Down
5 changes: 0 additions & 5 deletions src/python/tests/test_multigather.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ def test_missing_querylist(runtmp, capfd, indexed, zip_query):

captured = capfd.readouterr()
print(captured.err)

# assert 'Error: failed to load query' in captured.err
assert 'Error: No such file or directory' in captured.err


Expand Down Expand Up @@ -313,8 +311,6 @@ def test_nomatch_query(runtmp, capfd, indexed, zip_query):

captured = capfd.readouterr()
print(captured.err)

# assert "WARNING: no compatible sketches in path " in captured.err
assert "WARNING: skipped 1 query paths - no compatible signatures." in captured.err


Expand Down Expand Up @@ -424,7 +420,6 @@ def test_bad_against_2(runtmp, capfd, zip_query):


def test_empty_against(runtmp, capfd):
# like fastgather - exit gracefully.
# test bad 'against' file - in this case, an empty one
query = get_test_data('SRR606249.sig.gz')
query_list = runtmp.output('query.txt')
Expand Down
6 changes: 3 additions & 3 deletions src/python/tests/test_multisearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ def test_missing_query(runtmp, capfd, zip_query):
sig47 = get_test_data('47.fa.sig.gz')
sig63 = get_test_data('63.fa.sig.gz')

#make_file_list(query_list, [sig2, sig47, sig63])
make_file_list(against_list, [sig2, sig47, sig63])

output = runtmp.output('out.csv')
Expand Down Expand Up @@ -173,6 +172,7 @@ def test_sig_query(runtmp, capfd):
df = pandas.read_csv(output)
assert len(df) == 1


def test_bad_query(runtmp, capfd):
# test with a bad query list (a missing file)
query_list = runtmp.output('query.txt')
Expand Down Expand Up @@ -238,7 +238,7 @@ def test_missing_against(runtmp, capfd, zip_db):
# do not create against_list

if zip_db:
#.zip but don't create the file
#specify .zip but don't create the file
against_list = runtmp.output('db.zip')

output = runtmp.output('out.csv')
Expand All @@ -263,7 +263,6 @@ def test_sig_against(runtmp, capfd):
sig63 = get_test_data('63.fa.sig.gz')

make_file_list(query_list, [sig2, sig47, sig63])
#make_file_list(against_list, [sig2, sig47, sig63])

output = runtmp.output('out.csv')

Expand All @@ -277,6 +276,7 @@ def test_sig_against(runtmp, capfd):
df = pandas.read_csv(output)
assert len(df) == 1


def test_bad_against(runtmp, capfd):
# test with a bad against list (a missing file)
query_list = runtmp.output('query.txt')
Expand Down
10 changes: 0 additions & 10 deletions src/python/tests/test_pairwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def test_simple_threshold(runtmp, zip_query):
assert len(df) == 1



def test_sig_query(runtmp, capfd):
# sig query is ok now, but fails bc only one sig
sig2 = get_test_data('2.fa.sig.gz')
Expand Down Expand Up @@ -152,7 +151,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')
Expand Down Expand Up @@ -274,11 +272,6 @@ def test_load_only_one_bug(runtmp, capfd, zip_db):
assert not 'WARNING: no compatible sketches in path ' in captured.err







@pytest.mark.parametrize("zip_query", [False, True])
def test_md5(runtmp, zip_query):
# test that md5s match what was in the original files, not downsampled etc.
Expand Down Expand Up @@ -314,8 +307,6 @@ def test_md5(runtmp, zip_query):
print(md5s)




def test_simple_prot(runtmp):
# test basic execution with protein sigs
sigs = get_test_data('protein.zip')
Expand Down Expand Up @@ -368,7 +359,6 @@ def test_simple_prot(runtmp):
assert intersect_hashes == 342



def test_simple_dayhoff(runtmp):
# test basic execution with dayhoff sigs
sigs = get_test_data('dayhoff.zip')
Expand Down
11 changes: 1 addition & 10 deletions src/python/tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def test_missing_query(runtmp, capfd, indexed, zip_query):
sig47 = get_test_data('47.fa.sig.gz')
sig63 = get_test_data('63.fa.sig.gz')

#make_file_list(query_list, [sig2, sig47, sig63])
#make_file_list(query_list, [sig2, sig47, sig63]) # don't make query
make_file_list(against_list, [sig2, sig47, sig63])

if indexed:
Expand Down Expand Up @@ -266,15 +266,9 @@ def test_sig_query(runtmp, capfd, indexed):

output = runtmp.output('out.csv')

# with pytest.raises(utils.SourmashCommandFailed):
runtmp.sourmash('scripts', 'manysearch', sig2, against_list,
'-o', output)

# captured = capfd.readouterr()
# print(captured.err)

# assert 'Error: invalid line in fromfile' in captured.err


@pytest.mark.parametrize("indexed", [False, True])
def test_bad_query_2(runtmp, capfd, indexed):
Expand Down Expand Up @@ -363,15 +357,13 @@ def test_nomatch_against(runtmp, capfd):
sig2 = get_test_data('2.fa.sig.gz')
sig47 = get_test_data('47.fa.sig.gz')
sig63 = get_test_data('63.fa.sig.gz')
# nomatch_sketch = get_test_data('genome-s11.fa.gz.sig')
nomatch_sketch = get_test_data('SRR606249.sig.gz')

make_file_list(query_list, [sig2, sig47, sig63])
make_file_list(against_list, [nomatch_sketch])

output = runtmp.output('out.csv')

# with pytest.raises(utils.SourmashCommandFailed):
runtmp.sourmash('scripts', 'manysearch', query_list, against_list,
'-o', output)

Expand Down Expand Up @@ -420,7 +412,6 @@ def test_empty_query(runtmp, indexed, capfd):

output = runtmp.output('out.csv')

# with pytest.raises(utils.SourmashCommandFailed):
runtmp.sourmash('scripts', 'manysearch', query_list, against_list,
'-o', output)

Expand Down

0 comments on commit 4169e50

Please sign in to comment.