@@ -208,3 +208,56 @@ def test_input_path_spaces(tmpdir):
208208 TESTDATA_DIR / "word_count/correct/output" ,
209209 tmpdir / "output" ,
210210 )
211+
212+
213+ def test_map_exe_error_msg (tmpdir ):
214+ """Map exe returns non-zero with stderr output should produce an
215+ error message and forward the stderr output.
216+ """
217+ with tmpdir .as_cwd (), pytest .raises (madoop .MadoopError ,
218+ match = "Map error message" ):
219+ madoop .mapreduce (
220+ input_path = TESTDATA_DIR / "word_count/input" ,
221+ output_dir = "output" ,
222+ map_exe = TESTDATA_DIR / "word_count/map_error_msg.py" ,
223+ reduce_exe = TESTDATA_DIR / "word_count/reduce.py" ,
224+ num_reducers = 4 ,
225+ partitioner = None ,
226+ )
227+
228+ with tmpdir .as_cwd (), pytest .raises (madoop .MadoopError ,
229+ match = "Map error message" ):
230+ map_stage (
231+ exe = TESTDATA_DIR / "word_count/map_error_msg.py" ,
232+ input_dir = TESTDATA_DIR / "word_count/input" ,
233+ output_dir = Path (tmpdir ),
234+ )
235+
236+
237+ def test_partition_exe_error_msg (tmpdir ):
238+ """Partition exe returns non-zero with stderr output should produce an
239+ error message and forward the stderr output.
240+ """
241+ with tmpdir .as_cwd (), pytest .raises (madoop .MadoopError ,
242+ match = "Partition error message" ):
243+ madoop .mapreduce (
244+ input_path = TESTDATA_DIR / "word_count/input" ,
245+ output_dir = "output" ,
246+ map_exe = TESTDATA_DIR / "word_count/map.py" ,
247+ reduce_exe = TESTDATA_DIR / "word_count/reduce.py" ,
248+ num_reducers = 4 ,
249+ partitioner = TESTDATA_DIR / "word_count/partition_error_msg.py" ,
250+ )
251+
252+
253+ def test_reduce_exe_error_msg (tmpdir ):
254+ """Reduce exe returns non-zero with stderr output should produce an
255+ error message and forward the stderr output.
256+ """
257+ with tmpdir .as_cwd (), pytest .raises (madoop .MadoopError ,
258+ match = "Reduce error message" ):
259+ reduce_stage (
260+ exe = TESTDATA_DIR / "word_count/reduce_error_msg.py" ,
261+ input_dir = TESTDATA_DIR / "word_count/input" ,
262+ output_dir = Path (tmpdir ),
263+ )
0 commit comments