zc.recipe.testrunner hook?

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I'm not sure this is the best place to ask about zc.recipe.testrunner, but I will anyway :).
Besides converting to zc.buildout, over my recent forced vacation, I also converted Mailman 3 to zc.recipe.testrunner. This is another bit of awesome from Zope I'm glad to be using.
One small problem though: I need to hook into the option parser to add a few more options. For example, I'm adding a -e/--stderr option which sets up logging propagation for some of my subprocess tests.
The way I've done it is to add this to my buildout.cfg file:
[test] recipe = zc.recipe.testrunner ... # Hack in extra arguments to zope.testrunner. initialization = from mailman.testing.layers import ConfigLayer; ConfigLayer.hack_options_parser()
The hack_options_parser() method looks like this:
def hack_options_parser(cls): """Hack our way into the zc.testing framework.
Add our custom command line option parsing into zc.testing's. We do the imports here so that if zc.testing isn't invoked, this stuff never gets in the way. This is pretty fragile, depend on changes in the zc.testing package. There should be a better way! """ from zope.testing.testrunner.options import parser parser.add_option('-e', '--stderr', action='callback', callback=cls.handle_stderr, help=_('Propagate log errors to stderr.'))
So as the comment asks passive-aggressively: is there a better way?
Thanks, Barry
participants (1)
-
Barry Warsaw