Commit a4da9b23 authored by Sander Bollen's avatar Sander Bollen
Browse files

add rudimentary testing

parent e5a5710c
......@@ -48,7 +48,7 @@ def is_at_least_version_samtools(version_str, version_tupl):
:raises TypeError: if version_tupl contains non-integer
"""
regex = re.compile('^(\d+)\.(\d+).*$')
if "_" not in version_str:
if " " not in version_str:
match = regex.match(version_str)
else:
match = regex.match(version_str.split(" ")[-1])
......
flake8
pytest
pytest-cov
\ No newline at end of file
"""
test_utils.py
~~~~~~~~~~~~~
:copyright: (c) 2018 Sander Bollen
:copyright: (c) 2018 Leiden University Medical Center
:license: MIT
"""
import pytest
from prinia.utils import is_at_least_version_samtools
samtools_version_data = [
("1.9-33-g2d34e15", (1, 3), True),
("1.2-33-g2d34e15", (1, 3), False),
("1.9", (1, 3), True),
("1.2", (1, 3), False),
("samtools 1.9-33-g2d34e15", (1, 3), True),
("samtools 1.9", (1, 3), True),
("samtools 1.2", (1, 3), False)
]
@pytest.mark.parametrize("version_str, version_tupl, expected",
samtools_version_data)
def test_is_at_least_version_samtools(version_str, version_tupl, expected):
val = is_at_least_version_samtools(version_str, version_tupl)
assert val == expected
[tox]
envlist = py27, py34
[testenv]
usedevelop = True
commands =
# flake8 --statistics tests prinia
py.test --cov=prinia --cov-report term-missing tests prinia
deps =
-rrequirements.txt
-rrequirements-dev.txt
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment