Questions after testtools merge

Martin (gzlist) gzlist at googlemail.com
Mon Dec 28 21:18:35 GMT 2009


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

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

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.

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?

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.

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

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

Martin



More information about the bazaar mailing list