Comment 10 for bug 82693

Revision history for this message
James Westby (james-w) wrote : Re: Ability to run tests in a particular plugin

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__':
       import os
       import subprocess
       import sys
       dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "plugins")
       retcode = subprocess.call("bzr selftest -s bzrlib.plugins.<plugin name>",
               shell=True, env={"BZR_PLUGIN_PATH": dir})
       sys.exit(retcode)

Put that at the top of __init__.py (before any "import bzrlib.plugins.<plugin name>"
type imports), with a symlink in the branch that points

   ./plugins/<plugin name> -> ./

so that it is loaded under the correct name. The "python __init__.py" will run the
tests.

This obviously doesn't work on windows, so it's not good for wide adoption.

Thanks,

James