tholo / pytest-flake8

pytest plugin to run flake8
Other
117 stars 47 forks source link

Remove Python 2 support and dependency on py, fixes #81 #82

Closed erikkemperman closed 2 years ago

erikkemperman commented 2 years ago

Hi,

I just ran into https://github.com/tholo/pytest-flake8/issues/81 and looked into it a bit.

It seems that the stderr/stdout capturing, currently handled by py, doesn't agree with flake8 report generation...

Considering that py is in maintenance mode and Python 2 is officially pushing the daisies, I thought you might consider this PR which uses capturing utilities available in the standard library, contextlib -- since 3.4.

erikkemperman commented 2 years ago

Sorry, docs say that redirecting stdout was added in 3.4, but stderr was only added in 3.5 -- amended the commit, and threw in 3.10 for good measure.

justinrmiller commented 2 years ago

Could we get this merged down and released? This is causing issues for us as well. Thank you!

khink commented 2 years ago

This looks like a good fix, well at least it seems to agree with the pytest maintainer's suggestion in https://github.com/PyCQA/flake8/pull/1422 ("use io.TextIOWrapper").

@tholo Do you have any reservations about this MR? Maybe some changes needed before it can be merged? People could help in getting these changes in, just let us know.

boidolr commented 2 years ago

Would love this too 👍 @erikkemperman I think a change to .travis.yml is needed too, to reflect the versions in the tests.

erikkemperman commented 2 years ago

@boidolr Thanks, I've amended the travis config now.

erikkemperman commented 2 years ago

Sorry for the force pushes, had not configured my gpg key properly on new laptop

JulienPalard commented 2 years ago

I tested this branch and it works for me.