[TIP] Using Nose with Setuptools

rdegges at gmail.com rdegges at gmail.com
Sun Aug 1 00:10:31 PDT 2010


Hi everyone,

This is my first post to python-testing, so please forgive me if I'm asking  
a question which has already been answered. I've tried looking for  
solutions to this problem online, but have only found half-answers.

Anyhow, my question is: What is the best way to integrate nose / coverage  
tests with my python package using setuptools?

Basically, I have a module which I'd like to distribute using setuptools  
and PyPI (pretty typical stuff). My directory tree looks like:  
http://pastie.org/private/trftwzclq6jgx2di73rttg

Currently, if I want to run tests with nose, I do it from within the root  
`pycall` directory, and I run:

nosetests --with-doctest --doctest-extension=txt --with-coverage  
--cover-erase -v

What I'm trying to do is be more modular, and test my entire python package  
at once. So I was reading more about setuptools, and discovered that  
setuptools has several test options that can be specified to run tests when  
installing the package. However, I can't figure out how (or why) I should  
use those options.

Basically, I want my fully distributable python package to be able to:

1. Run all tests with nose before the package is installed. This should  
verify that everything works as expected before the package can be  
installed on a user's box.
2. Allow other developers to install my module, and instantly have a  
development environment setup so that they can work on the project without  
any hassle.
3. Allow for some sort of easy-to-use continuous integration program like  
buildbot or tox to auto build my module and run my tests whenever I check  
code into my version control system.

What is the best way for me to do this?

Thanks so much, sorry if my question is a bit jumbled about.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20100801/b4aea663/attachment.html>


More information about the testing-in-python mailing list