[New-bugs-announce] [issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

STINNER Victor report at bugs.python.org
Wed May 3 19:50:04 EDT 2017

New submission from STINNER Victor:

Running test_sax of Python 2.7 on Windows emits the following warning:

Warning -- files was modified by test_sax

The problem is that os.unlink(TESTFN) ignores all OSError: os.unlink(TESTFN) fails because there is still an open file object somewhere.

The bug is in the test_parse_bytes() of test_sax, on check_parse(TESTFN) which raises an exception as expected.

xml.sax.parse() should close the parser on exception.

On master, test_sax explicitly expects a ResourceWarning, WTF?

        with support.check_warnings(('unclosed file', ResourceWarning)):                           
            # XXX Failed parser leaks an opened file.                                              
            with self.assertRaises(SAXException):                                                  
            # Collect leaked file.                                                                 

See also issue #15388.

components: Tests, XML
messages: 292946
nosy: haypo
priority: normal
severity: normal
status: open
title: [Windows] test_sax: Warning -- files was modified by test_sax
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list