Message99425
Sprinkled throughout CPython's test modules are snippets of code such as the following taken from 2.7A3's test_old_mailbox.py (line 141):
box = mailbox.UnixMailbox(open(self._path, 'r'))
The key thing to observe here is the file being opened yet never has it's 'close' method explicitly called. While this is fine for CPython's rather predictable garbage collections, it's quite possible that in alternate implementations of Python this file object won't be destroyed until well after line 141. This can result in seemingly random failures of CPython's tests under alternate implementations of Python.
The solution to this problem would be to consistently use the 'with' statement (or alternatively close all open file objects) throughout all CPython test modules.
I've gone ahead and submitted an updated (2.7A3) version of test_old_mailbox.py which addresses this. We can find other places where this is going on as well, but for the most part the tests already seem to be doing the right thing. |
|
Date |
User |
Action |
Args |
2010-02-16 17:43:51 | midnightdf | set | recipients:
+ midnightdf |
2010-02-16 17:43:51 | midnightdf | set | messageid: <1266342231.42.0.692171370087.issue7944@psf.upfronthosting.co.za> |
2010-02-16 17:43:49 | midnightdf | link | issue7944 messages |
2010-02-16 17:43:49 | midnightdf | create | |
|