[Tutor] redirecting testing output to file, using two different options
yosi.levy99 at gmail.com
Thu May 17 02:20:41 EDT 2018
As I understand from documentation reading, pytest does not support
advanced file handling like logging module..
for example: log file rotate, limit file size etc.
I am using OS Centos6
2018-05-16 21:48 GMT+03:00 Mats Wichmann <mats at wichmann.us>:
> On 05/16/2018 02:53 AM, Yosef Levy wrote:
> > Hello All,
> > I have testing environment.
> > Code is written under Python 2.6.
> Why? 2.6 was retired in October 2013. For long life of your code you
> should be using Python 3, but at least 2.7 is still current and getting
> updates (for another 18 months or so).
> > testing output should be redirected to log file.
> > I am using two different file handling, in order to log output:
> > 1. logging module:
> > 2. but if I want to redirect assert messages to file, I have to:
> > import unittest2
> > Question:
> > Is the a way to 'merge' the above two different ways output to file?
> > Or, is there a way to redirect assert messages to logging module methods?
> If you use pytest, this should be fairly straightforward. It normally
> captures stdout and stderr (the latter should have your asserts), and
> with a plugin, puts logging output on the same basis, so you get get
> everything going the same place:
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
More information about the Tutor