Re: Getting nice logging outputs in py.test
Amber Brown <[email protected]> Fri, 5 Jul 2019 20:47:29 +1000
| Newsgroups | gmane.comp.python.twisted |
|---|---|
| Message-ID | <[email protected]> |
On 5/7/19 8:27 pm, Thomas Westfeld wrote: >>> Dear all, >>> >>> I am having an issue with logging of my Twisted application. I am using the new >> twisted.logger framework. The output produced by twist or twistd when runnning my >> plugin is nice. >>> However when running a test suite using py.test I only get this as an output to >> stdout: >> >> How are you running the reactor in your pytest suites? I've not found a >> sane way to do this and so would recommend sticking with trial, crufty >> and old though it feels... > Well actually I do not. I use the subprocess module to start the server using twist and then use requests in the tests to test the HTML server and compare the results with the expected results. > > And yes py.test eats stdout but it is great as I need a good looking html test report which can be also customized and py.test gives me just this. > > Sounds like there is no easy way of configuring a nice stdout log... Oh, that's why. If twist detects something that isn't a terminal, it outputs JSON because it's not a human looking at it, which is easier for logging systems to consume than straight text. You can pass `--log-format=text` as a command line argument to twist to override this. - Amber _______________________________________________ Twisted-Python mailing list [email protected] https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python