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