python nose(一)

Note to Users

Nose has been in maintenance mode for the past several years and will likely cease without a new person/team to take over maintainership.  New projects should consider using Nose2, py.test, or just plain unittest/unittest2.html

【Nose在過去幾年已經處於維護模式,不久極可能沒有任何團隊接受而中止使用。新的項目應該使用Nose2,py.test或者unittest/unittest2.】
python

Installation and quick start

On most UNIX-like systems, you’ll probably need to run these commands as root or using sudo.git

在大多數相似UNXI系統中,你可能須要以root或者sudo來運行這些命令github

Install nose using setuptools/distribute:bootstrap

【使用setuptools安裝nose】ide

easy_install nose

Or pip:測試

pip install nose

Or, if you don’t have setuptools/distribute installed, use the download link at right to download the source package, and install it in the normal fashion: Ungzip and untar the source package, cd to the new directory, and:ui

【或者,若是你還未安裝setuptools,點擊右邊的鏈接下載源碼包,而後以一般的方式來安裝:解壓源碼包,進入解壓目錄,而後執行:】this

python setup.py install

However, please note that without setuptools/distribute installed, you will not be able to use third-party nose plugins.google

This will install the nose libraries, as well as the nosetestsscript, which you can use to automatically discover and run tests.

【然而,注意,若沒有安裝setuptools,將不能使用第三方的nose插件】

【這將會安裝nose庫,以及nosetests script,它能夠自動檢索並運行測試case】

Now you can run tests for your project:【如今,在你的項目中,能夠運行測試】

cd path/to/project
nosetests

You should see output something like this:【你會看到相似下面的東西】

..................................
----------------------------------------------------------------------
Ran 34 tests in 1.440s

OK

Indicating that nose found and ran your tests.

For help with nosetests’ many command-line options, try:

【使用-h來獲取關於nosetests的幫助以及更多的命令行參數】

nosetests -h

or visit the usage documentation.

Python3

nose supports python3. Building from source on python3 requiresdistribute. If you don’t have distribute installed, python3 setup.py install will install it via distribute’s bootstrap script.

Additionally, if your project is using 2to3, python3 setup.py nosetestscommand will automatically convert your sources with 2to3 and then run the tests with python 3.

Warning

nose itself supports python 3, but many 3rd-party plugins do not!


Documentation

Testing with nose      

Find out how to write, find and run tests using nose.

【怎麼寫代碼以及使用nose來運行case】
More >

Developing with nose      

Find out how to write your own plugins, and about nose        internals.

【若是編寫本身的插件,以及關於nose的內部組件】
More >

News      

What's new in this release?

【該發佈版本增長的新特性】
More >

Further reading      

Plugin recipes and usage examples, trivia and other  uncategorizable items.


More >

Indices and tables      


Next topic

Testing with nose

This Page

Download

Install

  • This release:
       easy_install nose==1.3.7

  • Development (unstable):
       easy_install nose==dev

Community

  • Users' discussion list

    • Talk about using nose. Get help. Give help!

  • TIP list

    • The Testing In Python list features wide-ranging  discussions of all topics of interest to python testers.

Tracker

  • Report bugs, request features, wik the wiki, browse source.

Other links

Quick search

Enter search terms or a module, class or function name.

相關文章
相關標籤/搜索