70
70
),
71
71
('boolean' , script_b , lambda x : [x , '--help' ]
72
72
),
73
+ ('help with c' , script_c , lambda x : [x , '--help' ]),
74
+ ('foo with c' , script_c ,
75
+ lambda x : [x , '--foo.one' , get_data ('tests/echo.cwl' ), '--foo.two' , 'test' ]
76
+ )
73
77
]
74
78
75
79
@needs_docker
@@ -78,34 +82,12 @@ def test_argparse(name, script_contents, params):
78
82
try :
79
83
script = NamedTemporaryFile (mode = 'w' , delete = False )
80
84
script .write (script_contents )
81
- script .flush ()
82
85
script .close ()
83
86
84
- try :
85
- assert main (params (script .name )) == 0 , name
86
- except SystemExit as err :
87
- assert err .code == 0 , name
88
- finally :
89
- if os .path .exists (script .name ):
90
- os .remove (script .name )
91
-
92
- script_c_params = [
93
- (lambda x : [x , '--help' ]),
94
- (lambda x : [x , '--foo.one' , get_data ('tests/echo.cwl' ), '--foo.two' , 'test' ])
95
- ]
96
-
97
- @pytest .mark .parametrize ('params' , script_c_params )
98
- def test_argparse_record (params ):
99
- try :
100
- script = NamedTemporaryFile (mode = 'w' , delete = False )
101
- script .write (script_c )
102
- script .flush ()
103
- script .close ()
87
+ assert main (params (script .name )) == 0 , name
104
88
105
- try :
106
- assert main (params (script .name )) == 0
107
- except SystemExit as err :
108
- assert err .code == 0
89
+ except SystemExit as err :
90
+ assert err .code == 0 , name
109
91
finally :
110
92
if os .path .exists (script .name ):
111
- os .remove (script .name )
93
+ os .unlink (script .name )
0 commit comments