2
2
import argparse
3
3
import subprocess as sp
4
4
import sys
5
+ from unittest .mock import Mock
5
6
from test .integration import TestCaseIntegration
6
7
from moPepGen import cli
7
8
8
9
9
10
class TestParseArriba (TestCaseIntegration ):
10
11
""" Test cases for moPepGen parseSTARFusion """
11
- def test_parse_arriba (self ):
12
- """ Test parseArriba """
12
+ def create_base_args (self ) -> argparse . Namespace :
13
+ """ Create base args """
13
14
args = argparse .Namespace ()
14
15
args .command = 'parseArriba'
15
16
args .input_path = self .data_dir / 'fusion/arriba.txt'
@@ -24,6 +25,12 @@ def test_parse_arriba(self):
24
25
args .min_split_read2 = 1
25
26
args .min_confidence = 'medium'
26
27
args .quiet = False
28
+ args .skip_failed = False
29
+ return args
30
+
31
+ def test_parse_arriba (self ):
32
+ """ Test parseArriba """
33
+ args = self .create_base_args ()
27
34
cli .parse_arriba (args )
28
35
files = {str (file .name ) for file in self .work_dir .glob ('*' )}
29
36
expected = {'arriba.gvf' }
@@ -47,3 +54,16 @@ def test_parse_arriba_cli(self):
47
54
print (cmd )
48
55
print (res .stderr .decode ('utf-8' ))
49
56
raise
57
+
58
+ def test_parse_arriba_skip_failed (self ):
59
+ """ Test parseArriba with skip failed """
60
+ from moPepGen import parser
61
+ parser .ArribaParser .ArribaRecord .convert_to_variant_records = Mock (
62
+ side_effect = ValueError ()
63
+ )
64
+ args = self .create_base_args ()
65
+ with self .assertRaises (ValueError ):
66
+ cli .parse_arriba (args )
67
+
68
+ args .skip_failed = True
69
+ cli .parse_arriba (args )
0 commit comments