]> granicus.if.org Git - python/commit
Issue #26620: Fix ResourceWarning in test_urllib2_localnet
authorMartin Panter <vadmium+py@gmail.com>
Sat, 22 Oct 2016 01:28:21 +0000 (01:28 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Sat, 22 Oct 2016 01:28:21 +0000 (01:28 +0000)
commitd60ea5ff009e7e48be78c388f642cd64287655f7
treef8ef370f6c48d7547734ba5126d51c7adbf02eae
parent3b557991d4a7626cf12baf2277bc87acbc439744
Issue #26620: Fix ResourceWarning in test_urllib2_localnet

* Use context manager on urllib objects to ensure that they are closed on error
* Use self.addCleanup() to cleanup resources even if a test is interrupted
  with CTRL+c

This backports a patch by Victor Stinner.
Lib/test/test_urllib2_localnet.py