Hi,<div><br></div><div>I have started using the <a href="http://www.voidspace.org.uk/python/mock/index.html">Mock library</a> more and more. It&#39;s great for some things that are hard to test otherwise. At the same time, some of its concepts can be a little daunting to wrap my head around.</div>
<div><br></div><div>That said, I have a test where I assert that all my opened files have been properly closed throughout the lifetime of my application. It took me a while to figure out how to write it. The current state of art can be found here:</div>
<div><br></div><div><a href="https://gist.github.com/3323323">https://gist.github.com/3323323</a></div><div><br></div><div>I have to admit the code is quite cumbersome. So my question is, <b>can this be done in a more compact/efficient manner?</b> I&#39;ve been studying the &quot;<a href="http://www.voidspace.org.uk/python/mock/examples.html#mocking-open">Mocking open</a>&quot; example, but since I am not interested in asserting what was written, nor read, it is not really helpful to me.</div>
<div><br></div><div>Oh, and as always, feel free to point me to any older threads discussing this. I wish this mailing list was searchable...</div><div><br></div><div>Thanks,</div><div>Jens</div><br><br>-- <br><font color="#999999">Want to know how full my inbox is? Or how to get in touch with me faster? Or tell me your e-mail is not that important? Then check this out: <span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px"><a href="http://courteous.ly/4WtfZY" target="_blank">http://courteous.ly/4WtfZY</a></span></font><br>