@@ -126,13 +126,63 @@ def test_that_the_bioformats_info_test_command_is_produced(test_targets):
126126 assert "showinf" in process .command
127127
128128
129+ def test_that_the_bioformats_info_test_correctly_interprets_exit_code_0_and_1 (
130+ test_files , mocker
131+ ):
132+ # 0 is pass, 1 is fail
133+ tiff_file = test_files ["tiff" ]
134+ target = SingleTarget (tiff_file )
135+ with TemporaryDirectory () as tmp_dir :
136+ path_0 = Path (tmp_dir , "code_0.txt" )
137+ path_1 = Path (tmp_dir , "code_1.txt" )
138+ path_0 .write_text ("0" )
139+ path_1 .write_text ("1" )
140+ pass_outputs = {"std_out" : path_1 , "std_err" : path_1 , "exit_code" : path_0 }
141+ fail_outputs = {"std_out" : path_0 , "std_err" : path_0 , "exit_code" : path_1 }
142+
143+ test = tests .BioFormatsInfoTest (target )
144+ mocker .patch .object (test , "_find_process_outputs" , return_value = pass_outputs )
145+ test_status = test .get_status ()
146+ assert test_status == TestStatus .PASS
147+
148+ test = tests .BioFormatsInfoTest (target )
149+ mocker .patch .object (test , "_find_process_outputs" , return_value = fail_outputs )
150+ test_status = test .get_status ()
151+ assert test_status == TestStatus .FAIL
152+
153+
129154def test_that_the_ome_xml_schema_test_command_is_produced (test_targets ):
130155 target = test_targets ["tiff" ]
131156 test = tests .OmeXmlSchemaTest (target )
132157 process = test .generate_process ()
133158 assert "xmlvalid" in process .command
134159
135160
161+ def test_that_the_ome_xml_info_test_correctly_interprets_exit_code_0_and_1 (
162+ test_files , mocker
163+ ):
164+ # 0 is pass, 1 is fail
165+ tiff_file = test_files ["tiff" ]
166+ target = SingleTarget (tiff_file )
167+ with TemporaryDirectory () as tmp_dir :
168+ path_0 = Path (tmp_dir , "code_0.txt" )
169+ path_1 = Path (tmp_dir , "code_1.txt" )
170+ path_0 .write_text ("0" )
171+ path_1 .write_text ("1" )
172+ pass_outputs = {"std_out" : path_1 , "std_err" : path_1 , "exit_code" : path_0 }
173+ fail_outputs = {"std_out" : path_0 , "std_err" : path_0 , "exit_code" : path_1 }
174+
175+ test = tests .OmeXmlSchemaTest (target )
176+ mocker .patch .object (test , "_find_process_outputs" , return_value = pass_outputs )
177+ test_status = test .get_status ()
178+ assert test_status == TestStatus .PASS
179+
180+ test = tests .OmeXmlSchemaTest (target )
181+ mocker .patch .object (test , "_find_process_outputs" , return_value = fail_outputs )
182+ test_status = test .get_status ()
183+ assert test_status == TestStatus .FAIL
184+
185+
136186def test_that_the_md5_checksum_test_can_be_retrieved_by_name ():
137187 test = BaseTest .get_subclass_by_name ("Md5ChecksumTest" )
138188 assert test is tests .Md5ChecksumTest
0 commit comments