[TIP] Better debugging of ResourceWarnings
barry at python.org
Thu Jun 13 12:25:49 PDT 2013
I'm wondering if anybody has some advice for tracking down ResourceWarnings in
a test suite of some code written for Python 3.3.
I've got a few of these cropping up which are probably related to ssl sockets
that aren't getting closed properly, but it's been difficult for me to track
them down by code inspection alone. Even when I instrument my tox.ini file to
run the tests with -Werror::ResourceWarning, I don't get much more output than
test_load_index_with_device_keyring (resolver.tests.test_index.TestDownloadIndex) ... Exception ResourceWarning: ResourceWarning('unclosed <ssl.SSLSocket object, fd=5, family=2, type=1, proto=6>',) in <ssl.SSLSocket object, fd=5, family=2, type=1, proto=6> ignored
I suspect that the warning isn't directly tied to this test though because it
can occur in different places. It's probably due to something run by my
ThreadPoolExecutor and could be caused by a mock.
Just wondering if anybody has some general recommendations for getting better
error reporting out of Python for these types of ResourceWarnings.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: not available
More information about the testing-in-python