comparison test/test_runner.py @ 6:2b90d0574ea5 draft

planemo upload for repository https://github.com/COMBAT-TB/confil commit c84738cfc4876c591d7108229038a4001f836afb
author sanbi-uwc
date Tue, 05 Mar 2019 03:49:38 -0500
parents 53a61865e86e
children 5ec97cccb3fe
comparison
equal deleted inserted replaced
5:a7b05dd0087d 6:2b90d0574ea5
1 import os 1 import os
2 2
3 import pytest 3 import pytest
4 from click.testing import CliRunner 4 from click.testing import CliRunner
5 5
6 from confil.confil import confil 6 from confil.confil import confil, parse_report
7 7
8 CURR_DIR = os.path.dirname(os.path.abspath(__file__)) 8 CURR_DIR = os.path.dirname(os.path.abspath(__file__))
9 TEST_DATA_DIR = os.path.join(CURR_DIR, "test_data/") 9 TEST_DATA_DIR = os.path.join(CURR_DIR, "test_data/")
10 10 TEST_REPORT = os.path.join(TEST_DATA_DIR, "test_file.tab")
11 FILE_1 = os.path.join(TEST_DATA_DIR, "test_file_1.fastq") 11 FILE_1 = os.path.join(TEST_DATA_DIR, "test_file_1.fastq")
12 FILE_2 = os.path.join(TEST_DATA_DIR, "test_file_2.fastq") 12 FILE_2 = os.path.join(TEST_DATA_DIR, "test_file_2.fastq")
13 13
14 14
15 @pytest.fixture(scope="module") 15 @pytest.fixture(scope="module")
16 def cli_runner(): 16 def cli_runner():
17 runner = CliRunner() 17 runner = CliRunner()
18 return runner 18 return runner
19 19
20 20
21 @pytest.mark.skip(reason="No way of currently testing this. It's KRAKEN!")
21 def test_runner(cli_runner): 22 def test_runner(cli_runner):
22 result = cli_runner.invoke(confil, ["--paired", FILE_1, FILE_2]) 23 result = cli_runner.invoke(confil, ["--paired", FILE_1, FILE_2])
23 assert result.exit_code == 0 24 assert result.exit_code == 0
25
26
27 @pytest.mark.parametrize("test_input, expected", [
28 (type(parse_report(TEST_REPORT, 50)), list),
29 (parse_report(TEST_REPORT, 50)[5], 'Mycobacterium'),
30 (parse_report(TEST_REPORT, 50)[0], '55.84')
31 ])
32 def test_parse_report(test_input, expected):
33 assert test_input == expected
34
35
36 def test_parse_report_exception():
37 with pytest.raises(SystemExit):
38 parse_report(TEST_REPORT, 90)