Installing Nose

At the time of this writing, Nose's home page is google.com/p/python-">http://code.google.com/p/python-nose/, with downloads available at http://code.google.com/p/python-nose/ downloads/list. Go ahead and download the latest version, and uncompress it into a temporary directory. If you're using Windows, you'll need a program such as 7-Zip (http://7-zip.org/) to uncompress the file; Linux and Mac users won't need any special software.

After uncompressing Nose, we need to install it. Everything we had to consider when installing Mocker applies here too: If you installed Python, you can just change to the Nose directory and type:

$ python setup.py install

If you didn't install Python, but you're using version 2.6 or higher, you can instead type: $ python setup.py install --user

If you go for the - -user installation, you might need to add a directory to the search path of your operating system. You'll know you need to if you can't run the nosetests program after installing it. On Linux or Mac, the directory that you need to add is ~/.local/bin, while on Windows it's %APPDATA%\Python\Scripts. Additionally, on Windows you may need to create a file called nosetests.bat in the %APPDATA%\Python\Scripts directory, containing the line: @python %APPDATA%\Python\ Scripts\nosetests.

Sometimes, a tool called easy_install can simplify the installation process of Python modules and packages. If you want to give it a try, download and install setuptools from http://pypi.python.org/pypi/setuptools, and then run the command easy_install nose. Once that command is executed, you should be ready to use Nose.

After installing it, you should be able to run nosetests by typing its name on the command line. If you run it in an empty directory, you should see output similar to this:

$ nosetests

Ran G tests in G.GG7s OK

+1 0

Average user rating: 5 stars out of 1 votes

Post a comment

  • Receive news updates via email from this site