views:

183

answers:

1

I have installed pylons based application from egg, so it sits somewhere under /usr/lib/python2.5/site-packages. I see that the tests are packaged too and I would like to run them (to catch a problem that shows up on deployed application but not on development version).

So how do I run them? Doing "nosetests" from directory containing only test.ini and development.ini gives an error about nonexistent test.ini under site-packages.

A: 

Straight from the horse's mouth:

Install nose: easy_install -W nose.

Run nose: nosetests --with-pylons=test.ini OR python setup.py nosetests

To run "python setup.py nosetests" you need to have a [nosetests] block in your setup.cfg looking like this:

[nosetests]

verbose=True

verbosity=2

with-pylons=test.ini

detailed-errors=1

with-doctest=True

kylebrooks
I finally put this advice to work and discovered another thing: nosetests need to be run with --exe option, because it would otherwise ignore executable files, and files packaged with "python setup.py bdist_egg" have +x for some reason. So the command line looks like this for me: "nosetests --exe --with-pylons=test.ini mypackage.tests"
Pēteris Caune