Questions after testtools merge

Robert Collins robertc at robertcollins.net
Mon Dec 28 21:44:16 GMT 2009


On Mon, 2009-12-28 at 21:18 +0000, Martin (gzlist) wrote:
> Just spent a couple of hours getting my code working again
> post-testtools-merge and have some questions and comments.
> 
> The old TestCase.run had this finally code, is there an equivalent in testtools?
> 
>     saved_attrs = {}
>     for attr_name in self.attrs_to_keep:
>         if attr_name in self.__dict__:
>             saved_attrs[attr_name] = self.__dict__[attr_name]
>     self.__dict__ = saved_attrs

That code is replaced by discarding tests that have been run, a much
simpler way of freeing memory.

> TestCase.addCleanup is redundant to the same code in testtools.

Yes, there is more cleanup that can be done to reduce duplication; my
branch was aimed at the minimal feature equivalent.

> TestCase.setKeepLogfile is gone (though it is still used in
> TestCase._cleanupLogFile and mentioned in the TestCase._finishLogFile
> docstring), and there seems to be no way of keeping the file around.
> TestCase._get_log was ugly before and is worse now. I have
> monkey-patched keeping the log file back in for the moment.

Huh? I don't quite follow - I'll look at this next week. You shouldn't
be using _get_log anywhere now.

> The various TestCase._do_* methods are now marked as @staticmethod but
> retain the self argument, which is confusing to say the least. What's
> the reasoning here?

Its a more flexible API to permit simple helper functions to be used.
See the testtools docs.

> With testtools it seems that naffy _StringException instances are
> given to TestResult methods rather than the actual exception. How can
> this be avoided? Getting the traceback is a pain, as
> testtools.content.TracebackContent is just bogus - it will throw on
> non-ascii.

More details please, I spent some time testing this and getting it
solid. the content objects are MIME objects - they can encode arbitrary
data; if there is a bug in testtools, please file it!

> The timer for the logs doesn't seem to get reset each test any more,
> is this deliberate?

How do you mean? its not global....

> Have not actually been able to test a proper selftest run yet, so
> there may well be further issues.

Please file separate bugs for each issue with backtraces or simple test
cases, so that I can fix them.

-Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20091229/a7883c79/attachment.pgp 


More information about the bazaar mailing list