Skip to content

Commit dbbf005

Browse files
committed
add integration test
1 parent 9c61da5 commit dbbf005

2 files changed

Lines changed: 94 additions & 0 deletions

File tree

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pytest]
2+
markers =
3+
integration: end-to-end pipeline run (requires BLAST, primer3, bash scripts; slow)
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2025 CTLab-ITMO
4+
#
5+
# Authors: Daniil Smutin, Aleksandr Serdiukov, Vitalii Dravgelis, Artem Ivanov,
6+
# Aleksei Zabashta, Sergey Muravyov, and the CTLab-ITMO university team.
7+
#
8+
# Permission is hereby granted, free of charge, to any person obtaining a copy
9+
# of this software and associated documentation files (the "Software"), to deal
10+
# in the Software without restriction, including without limitation the rights
11+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
# copies of the Software, and to permit persons to whom the Software is
13+
# furnished to do so, subject to the following conditions:
14+
#
15+
# The above copyright notice and this permission notice shall be included in all
16+
# copies or substantial portions of the Software.
17+
#
18+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
# SOFTWARE.
25+
26+
"""Integration test equivalent to repo root test.sh (general FISH dataset)."""
27+
28+
import shutil
29+
import subprocess
30+
import sys
31+
from pathlib import Path
32+
33+
import pytest
34+
35+
PROJECT_ROOT = Path(__file__).resolve().parent.parent
36+
37+
38+
def _require_blast_tools():
39+
for cmd in ("makeblastdb", "blastn"):
40+
if shutil.which(cmd) is None:
41+
pytest.skip(f"{cmd} not on PATH")
42+
43+
44+
@pytest.mark.integration
45+
def test_pipeline_general_fish_from_test_sh(tmp_path):
46+
"""Mirror test.sh: small general run with visualization and AI enabled."""
47+
_require_blast_tools()
48+
49+
output = tmp_path / "output"
50+
cmd = [
51+
sys.executable,
52+
str(PROJECT_ROOT / "pipeline.py"),
53+
"-i",
54+
str(PROJECT_ROOT / "data/test/general/test.fna"),
55+
"-o",
56+
str(output),
57+
"-tb",
58+
str(PROJECT_ROOT / "data/test/general/fasta_base/true_base"),
59+
"-fb",
60+
str(PROJECT_ROOT / "data/test/general/fasta_base/false_base_1"),
61+
str(PROJECT_ROOT / "data/test/general/fasta_base/false_base_2"),
62+
"-a",
63+
"FISH",
64+
"--PRIMER_PICK_PRIMER",
65+
"5",
66+
"--PRIMER_NUM_RETURN",
67+
"5",
68+
"-N",
69+
"3",
70+
"--visualize",
71+
"True",
72+
"--AI",
73+
"True",
74+
]
75+
76+
result = subprocess.run(
77+
cmd,
78+
cwd=PROJECT_ROOT,
79+
capture_output=True,
80+
text=True,
81+
)
82+
if result.returncode != 0:
83+
pytest.fail(
84+
f"pipeline.py exited {result.returncode}\n"
85+
f"--- stdout ---\n{result.stdout}\n--- stderr ---\n{result.stderr}"
86+
)
87+
88+
assert (output / "modeling_results.tsv").is_file()
89+
assert (output / "output_dedegenerated.fa").is_file()
90+
assert (output / "visualizations").is_dir()
91+
assert any((output / "visualizations").iterdir())

0 commit comments

Comments
 (0)