Comment 11 for bug 82693

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 82693] Re: Ability to run tests in a particular plugin

On Thu, 2009-04-16 at 20:30 +0000, James Westby wrote:
> Hi,
>
> Having a better solution for this would be great, but with the help of
> jam and vila I just knocked this up:
>
> if __name__ == '__main__':

ug.

from bzrlib import option, commands
commands.Command.hooks.install_named_hook('extend_command',
    test_coverage, 'test_plugin')

def test_plugin(cmd):
    if cmd.name() != 'selftest':
        return
    def handle_test_plugin(option, name, value, parser):
        cmd.additional_selftest_args['starting_with'] = \
            'bzrlib.plugins.%s' % value
    cmd.takes_options = list(cmd.takes_options)
    cmd.takes_options.append(
        option.Option('test-plugin',
           help='Run tests for a single named plugin',
           custom_callback=handle_test_plugin))