From b21cc658ab4d50be00ec8c449d90a6eb7dc9b880 2013-10-22 00:48:13 From: Thomas Kluyver Date: 2013-10-22 00:48:13 Subject: [PATCH] Don't show subprocess output if there isn't any --- diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 666fa2f..5227765 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -426,11 +426,15 @@ class SubprocessStreamCapturePlugin(Plugin): def formatFailure(self, test, err): # Show output ec, ev, tb = err - ev = safe_str(ev) - out = [ev, '>> begin captured subprocess output <<', - self.stream_capturer.get_buffer().decode('utf-8', 'replace'), - '>> end captured subprocess output <<'] - return ec, '\n'.join(out), tb + captured = self.stream_capturer.get_buffer().decode('utf-8', 'replace') + if captured.strip(): + ev = safe_str(ev) + out = [ev, '>> begin captured subprocess output <<', + captured, + '>> end captured subprocess output <<'] + return ec, '\n'.join(out), tb + + return err formatError = formatFailure