On Aug 31, 10:44 am, Wyatt Baldwin <[email protected]> wrote: > On Aug 31, 7:49 am, harish <[email protected]> wrote: > > > What is the difference between running my unit tests with the command: > > 'python setup.pytest' > > and > > 'python setup.py nosetests' > > ? > > I'm curious about this too and also what the difference is between > those two commands and 'nosetests --with-pylons=test.ini'. I always > use this latter form rather than the two above.
I've done a little research into this, and this is what I've found so far: * python setup.py test In this case, 'test' is a distutils command added by setuptools. It works with the `test_suite` setting in setup.py, which will be set to 'nose.collector' when using `paster create -t pylons`. If the `test_suite` setting is removed, no tests will be run. * python setup.py nosetests In this case, 'nosetests' is a distutils command added by Nose. This command doesn't use the `test_suite` setting from setup.py. * nosetests This script is installed by Nose. It's just a front end to a setuptools entry point--a class in the Nose distribution that does the actual finding and running of tests. When using the pylons paster template, setup.cfg will include `with- pylons = test.ini` in the [nosetests] section. This is equivalent to running `nosetests --with-pylons=test.ini`. The --with-pylons option is added to Nose by Pylons; it makes sure your Pylons config is initialized before running your tests. I'm not sure what the differences are when running tests using these three commands. The main difference I can see (other than the error noted by the OP) is that the first two build the package first, whereas the last one doesn't. All three read setup.cfg and use the with-pylons setting. I'm guessing that there's no difference between the way the last two commands run the tests (other than the build step). With the first command, there's some setuptools machinery that wraps the test runner, and somewhere in there is where the OP's error comes from (I tried tracing through the setuptools code, but it's a maze and I don't have the time to navigate through it). --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
