[TIP] Bootstrapping Nose

Kumar McMillan kumar.mcmillan at gmail.com
Fri Jul 11 11:51:10 PDT 2008

On Fri, Jul 11, 2008 at 11:35 AM, Atul Varma <varmaa at gmail.com> wrote:
> http://hg.mozilla.org/labs/weave/index.cgi/file/389d9ff46d61/scripts/getnose.py
> To use it, one just has to "import getnose" before they "import nose".  If
> nose isn't already installed system-wide, the nose package is automatically
> downloaded and untarred in the current directory and the proper directory is
> added to sys.path (thereby obviating any need for admin privileges).  Thus
> Weave's testing infrastructure is able to use nose without having to
> explicitly require developers to retrieve it.
> Would this be of use to anyone?  Or was there an easier way for me to
> achieve the same end?  I'm just curious.

Atul, that definitely seems useful.  Managing dependencies will always
be tricky, IMO, and bootstrapping always feels awkward.  Some similar
ways you could do it would be to create a buildout recipe or use Poach

Buildout: http://pypi.python.org/pypi/zc.buildout/
I believe you'd want to make a buildout.cfg something like this

parts = nose
bin-directory = .

recipe = zc.recipe.egg
eggs = nose

... then I think you will get the script ./nosetests to run.  IIRC
buildout has its own automatic bootstrapping mechanism so that you
don't have to have buildout or setuptools installed.  I think.

Poach Eggs -- I haven't used it myself but if I understand it's a way
to simply add a list of requirements to a file and from that build the
eggs locally.  *However* I don't know if it does automatic
bootstrapping for the PoachEggs and setuptools installation

As for your approach, it's simple and elegant so that's a plus.  Do
plugins still work like this?  I imagine they would work as long as
they were easy_install'd since that activates their entry points.  If
you wanted to install local plugins without system wide installation
then I don't think adding to sys.path will be enough.  You'd have to
use one of the above approaches since they hook into the setuptools


More information about the testing-in-python mailing list