Re: [Twisted-Python] Getting nice logging outputs in py.test

2019-07-05 Thread Thomas Westfeld
>-Original Message-
>From: Twisted-Python [mailto:twisted-python-boun...@twistedmatrix.com] On
>Behalf Of Amber Brown
>Sent: Friday, July 05, 2019 12:47 PM
>To: twisted-python@twistedmatrix.com
>Subject: Re: [Twisted-Python] Getting nice logging outputs in py.test
>
>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.
>

This worked fine. Thanks alot!

>- Amber
>
>___
>Twisted-Python mailing list
>Twisted-Python@twistedmatrix.com
>https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


smime.p7s
Description: S/MIME cryptographic signature
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Getting nice logging outputs in py.test

2019-07-05 Thread Jean-Paul Calderone
On Fri, Jul 5, 2019 at 1:55 AM Chris Withers  wrote:

> On 04/07/2019 21:43, Jean-Paul Calderone wrote:
> > 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...
> >
> >
> > What feels crufty and old about trial?  And why is "old" a negative?
>
> "old" is negative here because things have moved on and trial hasn't.
>
> pytest feels like it's become the python standard now, so there's that.
> It's rich ecosystem of plugins is another one.
> The reliance on subclassing TestCase is nother.
> No fixtures.
>

Just for anyone who's interested, if you use testtools TestCase then you
get fixtures and a load of other nice features.  This is what I almost
always do for new test development now.  Interoperability between different
libraries is one of the few nice things that comes from xUnit so trial can
load and run these tests.

Poor support in pycharm for trial versus first class support for pytest.
>
> That's just off the top of my head, use pytest for a year or two and
> coming back to trial may well feel the same.
>

Don't assume I haven't used pytest just because I don't immediately and
unquestioningly express complete agreement with you. :)

Anyhow, I am less interested in trying to convince you you're wrong than I
am in learning from your experience - hence the request to expand on your
assessment.

Jean-Paul


>
> cheers,
>
> Chris
>
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Getting nice logging outputs in py.test

2019-07-05 Thread Amber Brown

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
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Getting nice logging outputs in py.test

2019-07-05 Thread Thomas Westfeld
>> 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...
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Getting nice logging outputs in py.test

2019-07-05 Thread Amber Brown

On 5/7/19 3:55 pm, Chris Withers wrote:

On 04/07/2019 21:43, Jean-Paul Calderone wrote:
    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...


What feels crufty and old about trial?  And why is "old" a negative?


"old" is negative here because things have moved on and trial hasn't.

pytest feels like it's become the python standard now, so there's that.
It's rich ecosystem of plugins is another one.
The reliance on subclassing TestCase is nother.
No fixtures.
Poor support in pycharm for trial versus first class support for pytest.

That's just off the top of my head, use pytest for a year or two and 
coming back to trial may well feel the same.


cheers,

Chris


To note, Trial still is the only Python test runner which reliably finds 
all of Twisted's tests, though ;)


- Amber

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Getting nice logging outputs in py.test

2019-07-04 Thread Chris Withers

On 04/07/2019 21:43, Jean-Paul Calderone wrote:

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...


What feels crufty and old about trial?  And why is "old" a negative?


"old" is negative here because things have moved on and trial hasn't.

pytest feels like it's become the python standard now, so there's that.
It's rich ecosystem of plugins is another one.
The reliance on subclassing TestCase is nother.
No fixtures.
Poor support in pycharm for trial versus first class support for pytest.

That's just off the top of my head, use pytest for a year or two and 
coming back to trial may well feel the same.


cheers,

Chris

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Getting nice logging outputs in py.test

2019-07-04 Thread Jean-Paul Calderone
On Thu, Jul 4, 2019 at 1:50 PM Chris Withers  wrote:

> On 04/07/2019 14:39, 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:
>

Are you letting pytest eat your stdout?  That's the default behavior, isn't
it?


>
> 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...
>
>
What feels crufty and old about trial?  And why is "old" a negative?

Jean-Paul
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Getting nice logging outputs in py.test

2019-07-04 Thread Chris Withers

On 04/07/2019 14:39, 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...


cheers,

Chris

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python