The subunit output formatter that was added recently currently raises
NotImplementedError when it's given a generic "error". The error()
method on formatters is used to communicate user error (e.g. when the
user selects incompatible options), internal framework errors (afaict,
only when there's a subprocess read error) and layer setUp errors.

I find the idea of masking layer setUp errors to be unconscionably
awful, so I've attached the following patch, which changes the subunit
formatter's error() method to print out whatever it gets. It doesn't
have any tests, but it's simple enough, and none of the other
formatters have tests for this method either.

Ideally, I think there should be a new method on OutputFormatter to
handle layer setup failure. Probably teardown failure too. If someone
wants to push back on this simple patch in favour of a new method, I
could probably be persuaded to do the work, provided I had clear
backwards compatibility guidelines.

=== modified file 'src/zope/testing/testrunner/formatter.py'
--- src/zope/testing/testrunner/formatter.py	2010-04-06 03:02:54 +0000
+++ src/zope/testing/testrunner/formatter.py	2010-04-10 15:27:41 +0000
@@ -795,8 +795,7 @@
         """Report an error."""
         # XXX: Mostly used for user errors, sometimes used for errors in the
         # test framework, sometimes used to record layer setUp failure (!!!).
-        # How should this be encoded?
-        raise NotImplementedError(self.error)
+        self._stream.write('%s\n' % (message,))
     def error_with_banner(self, message):
         """Report an error with a big ASCII banner."""

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to