[Biopython-dev] Leaked handles in PAML unit tests
Peter Cock
p.j.a.cock at googlemail.com
Tue Aug 2 16:43:30 UTC 2011
Hi Brandon,
Would you be able to look at these handle leaks in the PAML unit tests
some time?
test_PAML_baseml ... /Users/pjcock/lib/python3.2/unittest/case.py:574:
ResourceWarning: unclosed file <_io.TextIOWrapper name='PAML/bad1.ctl'
mode='r' encoding='UTF-8'>
callableObj(*args, **kwargs)
/Users/pjcock/lib/python3.2/unittest/case.py:574: ResourceWarning:
unclosed file <_io.TextIOWrapper name='PAML/bad2.ctl' mode='r'
encoding='UTF-8'>
callableObj(*args, **kwargs)
/Users/pjcock/lib/python3.2/unittest/case.py:574: ResourceWarning:
unclosed file <_io.TextIOWrapper name='/dev/null' mode='w'
encoding='UTF-8'>
callableObj(*args, **kwargs)
ok
test_PAML_codeml ... ok
test_PAML_yn00 ... /Users/pjcock/lib/python3.2/unittest/case.py:574:
ResourceWarning: unclosed file <_io.TextIOWrapper name='PAML/bad3.ctl'
mode='r' encoding='UTF-8'>
callableObj(*args, **kwargs)
ok
This is warning is new under Python 3.2, but this kind of code can and
has caused bugs on Windows (can't delete files if there is an open
handle) and Jython (different GC collection, so implicit handle closing
is stochastic). See also:
http://bugs.python.org/issue10093
Note there are other cases of this, some in PopGen (which may
explain a periodic failure under Jython), and in test_SCOP_Astral.py
(where the object design makes this difficult to avoid IIRC), etc.
Peter
More information about the Biopython-dev
mailing list