New submission from Ben Hayden <hayden...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue11550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to