[issue10512] regrtest ResourceWarning - unclosed sockets and files

Nadeem Vawda report at bugs.python.org
Thu Jan 6 02:17:13 CET 2011


Nadeem Vawda <nadeem.vawda at gmail.com> added the comment:

Awesome. That just leaves test_urllibnet, test_urllib2net, and test_cgi. I'm hoping to post patches for the first two tomorrow.

About test_cgi, I've fiddled around with it a bit more. The leak manifests itself with any set of tests including test_cgi and test___all__, for example:

  ☿ ./python -Wd -E -bb -m test.regrtest test___all__ test_cgi
  [1/2] test___all__
  [2/2] test_cgi
  All 2 tests OK.
  sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='/dev/null' encoding='UTF-8'>

... but not with any other 2-test combination. This led me to think it was something specific to test___all__, but it does also come up when running all tests *except* test___all__.

I'm guessing there's something somewhere that's causing the cgi module to be garbage-collected between the tests finishing and the process terminating. Without some familiarity with unittest's internals, I can't say anything more, though.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10512>
_______________________________________


More information about the Python-bugs-list mailing list