annotate tests/test_shm_csr.py @ 92:cf8ad181628f draft

planemo upload commit 36be3b053802693392f935e6619ba3f2b1704e3c
author rhpvorderman
date Mon, 12 Dec 2022 12:32:44 +0000
parents 6809c63d9161
children 8fcf31272f6e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
83
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
1 # Copyright (c) 2021 Leiden University Medical Center
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
2 #
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
4 # of this software and associated documentation files (the "Software"), to deal
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
5 # in the Software without restriction, including without limitation the rights
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
6 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
7 # copies of the Software, and to permit persons to whom the Software is
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
8 # furnished to do so, subject to the following conditions:
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
9 #
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
10 # The above copyright notice and this permission notice shall be included in
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
11 # all copies or substantial portions of the Software.
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
12 #
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
19 # SOFTWARE.
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
20
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
21 import os
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
22 import shutil
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
23 import subprocess
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
24 import sys
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
25 import tempfile
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
26 from pathlib import Path
90
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
27 from xml.etree import ElementTree
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
28 from xml.etree.ElementTree import Element
83
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
29
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
30 import pytest
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
31
90
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
32 GIT_ROOT = Path(__file__).parent.parent.absolute()
83
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
33 TEST_DIR = Path(__file__).parent
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
34 TEST_DATA_DIR = TEST_DIR / "data"
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
35 VALIDATION_DATA_DIR = TEST_DIR / "validation_data"
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
36 CONTROL_NWK377_PB_IGHC_MID1_40nt_2 = TEST_DATA_DIR / "CONTROL_NWK377_PB_IGHC_MID1_40nt_2.txz"
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
37
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
38
90
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
39 def get_container():
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
40 tool = ElementTree.parse(GIT_ROOT / "shm_csr.xml").getroot()
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
41 requirements: Element = tool.find("requirements")
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
42 container = requirements.find("container")
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
43 return container.text
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
44
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
45
83
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
46 @pytest.fixture(scope="module")
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
47 def shm_csr_result():
90
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
48 temp_dir = Path(tempfile.mkdtemp())
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
49 tool_dir = temp_dir / "shm_csr"
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
50 shutil.copytree(GIT_ROOT, tool_dir)
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
51 working_dir = temp_dir / "working"
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
52 working_dir.mkdir(parents=True)
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
53 output_dir = temp_dir / "outputs"
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
54 output_dir.mkdir(parents=True)
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
55 wrapper = str(tool_dir / "wrapper.sh")
83
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
56 input = str(CONTROL_NWK377_PB_IGHC_MID1_40nt_2)
90
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
57 out_files_path = output_dir / "results"
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
58 out_file = out_files_path / "result.html"
83
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
59 infile_name = "input_data"
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
60 functionality = "productive"
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
61 unique = "Sequence.ID"
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
62 naive_output = "no"
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
63 naive_output_ca = "None"
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
64 naive_output_cg = "None"
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
65 naive_output_cm = "None"
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
66 naive_output_ce = "None"
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
67 naive_output_all = "None"
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
68 filter_unique = "remove"
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
69 filter_unique_count = '2'
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
70 class_filter = '70_70'
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
71 empty_region_filter = 'FR1'
92
cf8ad181628f planemo upload commit 36be3b053802693392f935e6619ba3f2b1704e3c
rhpvorderman
parents: 90
diff changeset
72 # Skip baseline and changeo by default. These tools cannot be modified
cf8ad181628f planemo upload commit 36be3b053802693392f935e6619ba3f2b1704e3c
rhpvorderman
parents: 90
diff changeset
73 # anyway and take most of the test time to execute. The environment
cf8ad181628f planemo upload commit 36be3b053802693392f935e6619ba3f2b1704e3c
rhpvorderman
parents: 90
diff changeset
74 # variable can be set to "no" on the CI so the code path is tested
cf8ad181628f planemo upload commit 36be3b053802693392f935e6619ba3f2b1704e3c
rhpvorderman
parents: 90
diff changeset
75 # at the time a PR is ready.
cf8ad181628f planemo upload commit 36be3b053802693392f935e6619ba3f2b1704e3c
rhpvorderman
parents: 90
diff changeset
76 fast = os.environ.get("SHM_CSR_FAST", "yes")
83
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
77 cmd = [
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
78 "bash",
90
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
79 wrapper,
83
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
80 input,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
81 "custom",
90
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
82 str(out_file),
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
83 str(out_files_path),
83
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
84 infile_name,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
85 "-",
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
86 functionality,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
87 unique,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
88 naive_output,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
89 naive_output_ca,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
90 naive_output_cg,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
91 naive_output_cm,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
92 naive_output_ce,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
93 naive_output_all,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
94 filter_unique,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
95 filter_unique_count,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
96 class_filter,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
97 empty_region_filter,
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
98 fast
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
99 ]
90
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
100 docker_cmd = ["docker", "run", "-v", f"{temp_dir}:{temp_dir}",
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
101 "--rm", # Remove container after running
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
102 "-v", f"{input}:{input}",
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
103 "-w", str(working_dir),
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
104 # Run as current user which allows deletion of files.
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
105 # It also mitigates some security considerations
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
106 "-u", f"{os.getuid()}:{os.getgid()}",
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
107 # Run with default seccomp profile to mitigate mitigation slowdown
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
108 # http://mamememo.blogspot.com/2020/05/cpu-intensive-rubypython-code-runs.html
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
109 # This knocks down test runtime from 8 to 6 minutes.
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
110 "--security-opt", "seccomp=unconfined",
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
111 # Use a mulled container generated with `planemo mull`
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
112 "quay.io/biocontainers/mulled-v2-f7d31c9d7424063a492fc0e5ecbf89bc757c0107:2b50bdd4d8c1fefc6ec24b0753fad0dcecec843b-0"
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
113 ] + cmd
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
114 with open(temp_dir / "stderr", "wt") as stderr_file:
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
115 with open(temp_dir / "stdout", "wt") as stdout_file:
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
116 subprocess.run(docker_cmd, cwd=working_dir, stdout=stdout_file,
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
117 stderr=stderr_file, check=True)
83
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
118 yield Path(out_files_path)
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
119
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
120
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
121 def test_check_output(shm_csr_result):
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
122 assert shm_csr_result.exists()
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
123
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
124
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
125 @pytest.mark.parametrize("filename", os.listdir(VALIDATION_DATA_DIR))
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
126 def test_results_match_validation(shm_csr_result, filename):
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
127 with open(Path(shm_csr_result, filename)) as result_h:
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
128 with open(Path(VALIDATION_DATA_DIR, filename)) as validate_h:
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
129 for line in result_h:
90
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
130 # Skip two faulty lines in shm_overview.
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
131 # TODO: Fix the issue.
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
132 validation_line = validate_h.readline()
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
133 if filename == "shm_overview.txt":
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
134 if (line.startswith("RGYW (%)") or
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
135 line.startswith("WRCY (%)")):
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
136 continue
6809c63d9161 "planemo upload commit fd64827ff6e63df008f6f50ddb8576ad2b1dbb26"
rhpvorderman
parents: 83
diff changeset
137 assert line == validation_line
83
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
138
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
139
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
140 def test_nt_overview(shm_csr_result):
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
141 with open(Path(shm_csr_result, "sequence_overview", "ntoverview.txt")
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
142 ) as result_h:
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
143 with open(Path(TEST_DIR, "sequence_overview", "ntoverview.txt")
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
144 ) as validate_h:
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
145 for line in result_h:
729738462297 "planemo upload commit c0ffc68aec5836d5b20b543106493056a87edf57"
rhpvorderman
parents:
diff changeset
146 assert line == validate_h.readline()