Mercurial > repos > sanbi-uwc > confil
view test/test_runner.py @ 10:2cde7c81c694 draft
planemo upload for repository https://github.com/COMBAT-TB/confil commit 036172521321dbafe62e6d72b3a491f4bc4b9dc9-dirty
author | sanbi-uwc |
---|---|
date | Fri, 08 Mar 2019 12:46:23 -0500 |
parents | 2b90d0574ea5 |
children | 5ec97cccb3fe |
line wrap: on
line source
import os import pytest from click.testing import CliRunner from confil.confil import confil, parse_report CURR_DIR = os.path.dirname(os.path.abspath(__file__)) TEST_DATA_DIR = os.path.join(CURR_DIR, "test_data/") TEST_REPORT = os.path.join(TEST_DATA_DIR, "test_file.tab") FILE_1 = os.path.join(TEST_DATA_DIR, "test_file_1.fastq") FILE_2 = os.path.join(TEST_DATA_DIR, "test_file_2.fastq") @pytest.fixture(scope="module") def cli_runner(): runner = CliRunner() return runner @pytest.mark.skip(reason="No way of currently testing this. It's KRAKEN!") def test_runner(cli_runner): result = cli_runner.invoke(confil, ["--paired", FILE_1, FILE_2]) assert result.exit_code == 0 @pytest.mark.parametrize("test_input, expected", [ (type(parse_report(TEST_REPORT, 50)), list), (parse_report(TEST_REPORT, 50)[5], 'Mycobacterium'), (parse_report(TEST_REPORT, 50)[0], '55.84') ]) def test_parse_report(test_input, expected): assert test_input == expected def test_parse_report_exception(): with pytest.raises(SystemExit): parse_report(TEST_REPORT, 90)