[TIP] Bootstrapping Nose

Atul Varma varmaa at gmail.com
Fri Jul 11 12:03:45 PDT 2008


Thanks for the suggestions.  The plugin I wrote for finding xpcshell tests
worked because I just manually passed it in to nose; see the bottom of this
file:


http://hg.mozilla.org/labs/weave/index.cgi/file/389d9ff46d61/scripts/runtests.py

- Atul

On Fri, Jul 11, 2008 at 11:51 AM, Kumar McMillan <kumar.mcmillan at gmail.com>
wrote:

> 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
> Eggs.
>
> Buildout: http://pypi.python.org/pypi/zc.buildout/
> I believe you'd want to make a buildout.cfg something like this
>
> [buildout]
> parts = nose
> bin-directory = .
>
> [nose]
> 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
> themselves.
> http://www.openplans.org/projects/opencore/poacheggs
>
>
> 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
> framework.
>
> K
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.idyll.org/pipermail/testing-in-python/attachments/20080711/8bb981c2/attachment.htm 


More information about the testing-in-python mailing list