← Back to team overview

testtools-dev team mailing list archive

Re: [Merge] lp:~jml/testtools/more-content-convenience into lp:testtools

 

 * I've dropped attachFile. We can add it later if the people clamor for it.

 * I don't think they'd be better as stand-alone functions.  At the very least, standalone functions can be implemented in terms of classmethods (e.g. content_from_file = Content.from_file), but classmethods can only be built from functions if they drop the class-based dispatch.  As far as I can tell, it's a matter of taste.  I am willing to budge on this one.

 * I've added documentation to from_stream saying that it will close the stream when the iterator is exhausted, and made it actually close the stream.  The reasoning is that testtools doesn't really offer any sort of hook for a sensible place to close the stream.

 * I've dropped the read_now path from from_stream.

 * I've changed the read_now path in from_file to be completely separate from the lazy read path.

 * I couldn't get the fixture thing to work.

Unfortunately, without attachFile, we still don't have a nice syntax for the common case of "add this file as a detail during teardown".  The best we have is:
  self.addCleanup(lambda: self.addDetail('foo', Content.from_file('foo.txt', read_now=True)))

As opposed to:
  self.addCleanup(self.attachFile, 'foo', 'foo.txt', read_now=True)

I'm going to go away and think some more.
-- 
https://code.launchpad.net/~jml/testtools/more-content-convenience/+merge/44870
Your team testtools developers is requested to review the proposed merge of lp:~jml/testtools/more-content-convenience into lp:testtools.



Follow ups

References