abalkin / pytest-leaks

A pytest plugin to trace resource leaks.
https://abalkin.github.io/pytest-leaks
Other
115 stars 4 forks source link

Printin/writing to stdout within test suit causes false positives #24

Closed seberg closed 5 years ago

seberg commented 5 years ago

Even when tests do not fail, a simple print() seems to leak references because pytest holds on to the strings, running pytest with -s "fixes" the issue.

I am not actually sure that this is a pytest-leaks issue. I am not sure how to get around this, maybe the only thing would be to clean up the capturing manually (at least if no error happened), or maybe we should just mention in the documentation for now that -s fixes this issue.

pv commented 5 years ago

I think we should flush pytest recorded output, even if this requires clobbering some internals (but those seem to have remained stable in pytest3,4,5 so probably fine).

gh-25