[New-bugs-announce] [issue11550] Fix ResourceWarning in test_pulldom

Ben Hayden report at bugs.python.org
Tue Mar 15 06:02:31 CET 2011


New submission from Ben Hayden <hayden767 at gmail.com>:

When running the test_pulldom test with a latest checkout of cpython from hg.python.org on Ubuntu 10.10 x64, the following ResourceWarning is thrown:

test_parse (test.test_pulldom.PullDOMTestCase)
Minimal test of DOMEventStream.parse() ... /home/benhayden/Documents/cpython/Lib/test/test_pulldom.py:35: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/benhayden/Documents/cpython/Lib/test/xmltestdata/test.xml' mode='r' encoding='UTF-8'>
  list(pulldom.parse(tstfile))
ok

This is because pulldom.parse returns an open file object if the argument it is passed is a string & not a file object. Attached is a patch that makes sure that file is closed.

----------
components: Tests
files: test_pulldom_resource_warning.patch
keywords: patch
messages: 130956
nosy: beardedp
priority: normal
severity: normal
status: open
title: Fix ResourceWarning in test_pulldom
type: resource usage
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file21203/test_pulldom_resource_warning.patch

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


More information about the New-bugs-announce mailing list