Skip to content

Commit a38daa8

Browse files
committed
Fix test_kaiju to use unittest.mock.patch instead of mocker
The test was using mocker fixture from pytest-mock which is not installed. Convert to use unittest.mock.patch like other tests in the same file. Also fix patch path to 'viral_ngs.metagenomics.kaiju.Kaiju.classify'.
1 parent 8ccdd31 commit a38daa8

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

tests/unit/classify/test_metagenomics.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,18 +273,18 @@ def test_krakenuniq(mocker):
273273
p.assert_called_with('db', ['input.bam'], num_threads=mock.ANY, filter_threshold=mock.ANY, out_reports=['output.report'], out_reads=['output.reads'])
274274

275275

276-
def test_kaiju(mocker):
277-
p = mocker.patch('classify.kaiju.Kaiju.classify')
278-
args = [
279-
'input.bam',
280-
'db.fmi',
281-
'tax_db',
282-
'output.report',
283-
'--outReads', 'output.reads',
284-
]
285-
args = metagenomics.parser_kaiju(argparse.ArgumentParser()).parse_args(args)
286-
args.func_main(args)
287-
p.assert_called_with('db.fmi', 'tax_db', 'input.bam', output_report='output.report', num_threads=mock.ANY, output_reads='output.reads')
276+
def test_kaiju():
277+
with patch('viral_ngs.metagenomics.kaiju.Kaiju.classify') as p:
278+
args = [
279+
'input.bam',
280+
'db.fmi',
281+
'tax_db',
282+
'output.report',
283+
'--outReads', 'output.reads',
284+
]
285+
args = metagenomics.parser_kaiju(argparse.ArgumentParser()).parse_args(args)
286+
args.func_main(args)
287+
p.assert_called_with('db.fmi', 'tax_db', 'input.bam', output_report='output.report', num_threads=mock.ANY, output_reads='output.reads')
288288

289289

290290
class TestBamFilter(TestCaseWithTmp):

0 commit comments

Comments
 (0)