You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I always want to see the output to stdout and stderr in the console, as well as have both recorded to the XML file, also when a test passes.
However, regardless of what settings I use for buffer, verbosity, stdout and stderr only go to the xml report file if the test passes. If it fails, I see both in the console and the file. This can be isolated to the use of the XMLTestRunner. If that line is commented out in the example below, buffer works as documented and expected, and stdout / stderr are shown in the console.
I can consistently reproduce this on Python 2.7 and 3.4.
Here is the example I'm running. (The print(file=sys.stderr) works in Python 3 only).
class TestXmlRunner(unittest.TestCase):
def test_hello(self):
print('hello')
print('hello stderr', file=sys.stderr)
self.assertTrue(True)
if __name__ == '__main__':
unittest.main(
testRunner=xmlrunner.XMLTestRunner(output='/tmp/test-reports',
verbosity=2, buffer=False),
verbosity=2, buffer=False)
Help, comments, fixes welcome. Happy to contribute with a fix, if I know what to fix.
Regards,
hblok
The text was updated successfully, but these errors were encountered:
I always want to see the output to stdout and stderr in the console, as well as have both recorded to the XML file, also when a test passes.
However, regardless of what settings I use for buffer, verbosity, stdout and stderr only go to the xml report file if the test passes. If it fails, I see both in the console and the file. This can be isolated to the use of the XMLTestRunner. If that line is commented out in the example below, buffer works as documented and expected, and stdout / stderr are shown in the console.
I can consistently reproduce this on Python 2.7 and 3.4.
Here is the example I'm running. (The print(file=sys.stderr) works in Python 3 only).
Help, comments, fixes welcome. Happy to contribute with a fix, if I know what to fix.
Regards,
hblok
The text was updated successfully, but these errors were encountered: