Skip to content

Commit

Permalink
swap ValueError for SourmashCommandFailed (#1709)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Aug 11, 2021
1 parent 4a9f1d1 commit f7f2e83
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/test_cmd_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -2391,7 +2391,7 @@ def test_sig_downsample_check_num_bounds_negative(runtmp):
c=runtmp
sig47 = utils.get_test_data('47.fa.sig')

with pytest.raises(ValueError):
with pytest.raises(SourmashCommandFailed):
c.run_sourmash('sig', 'downsample', '--num', '-5', sig47)

assert "ERROR: --num-hashes value must be positive" in c.last_result.err
Expand All @@ -2410,7 +2410,7 @@ def test_sig_downsample_check_num_bounds_more_than_maximum(runtmp):
c=runtmp
sig47 = utils.get_test_data('47.fa.sig')

with pytest.raises(ValueError):
with pytest.raises(SourmashCommandFailed):
c.run_sourmash('sig', 'downsample', '--num', '100000', sig47)

assert "WARNING: --num-hashes value should be <= 50000. Continuing anyway." in c.last_result.err
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sourmash.py
Original file line number Diff line number Diff line change
Expand Up @@ -3552,7 +3552,7 @@ def test_multigather_check_scaled_bounds_less_than_minimum(c):

cmd = 'multigather --query {} --db gcf_all -k 21 --scaled 50 --threshold-bp=0'.format(query_sig)
cmd = cmd.split(' ')
# Note: this is the value error that is emited, but we want the Warning from below to be generated instead. (ValueError: new scaled 50.0 is lower than current sample scaled 10000)
# Note: this is the value error that is emitted, but we want the Warning from below to be generated instead. (ValueError: new scaled 50.0 is lower than current sample scaled 10000)
with pytest.raises(SourmashCommandFailed) as exc:
c.run_sourmash(*cmd)

Expand Down Expand Up @@ -4846,7 +4846,7 @@ def test_watch_check_num_bounds_negative(runtmp):

c.run_sourmash('index', '--dna', '-k', '21', 'zzz', '1.sig')

with pytest.raises(ValueError) as exc:
with pytest.raises(SourmashCommandFailed) as exc:
c.run_sourmash('watch', '--ksize', '21', '-n', '-5', '--dna', 'zzz', testdata0)

assert "ERROR: --num-hashes value must be positive" in c.last_result.err
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sourmash_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_do_sourmash_compute_check_num_bounds_negative(runtmp):
testdata3 = utils.get_test_data('short3.fa')
sigfile = c.output('short.fa.sig')

with pytest.raises(ValueError):
with pytest.raises(SourmashCommandFailed):
c.run_sourmash('compute', '-k', '31', '--num-hashes', '-5', '-o', sigfile, '--merge', '"name"', testdata1, testdata2, testdata3)

assert "ERROR: --num-hashes value must be positive" in c.last_result.err
Expand Down

0 comments on commit f7f2e83

Please sign in to comment.