版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/chengqiuming/article/details/84402553
一 软件介绍
1 pip
地址:http://pypi.python.org/pypi/pip
简介:pip 是一个现代的,通用的 Python 包管理工具 。提供了对Python 包的查找、下载、安装、卸载的功能。
2 distribute
地址: http://pypi.python.org/pypi/distribute
简介:distribute是python的包管理工具,是setuptools的替代品。
https://blog.csdn.net/qq_31411579/article/details/79252208
3 nose
地址:http://pypi.python.org/pypi/nose/
简介:nose是一个比较牛的单元测试框架。
4 virtualenv
地址:http://pypi.python.org/pypi/virtualenv
简介:如果我们要同时开发多个应用程序,每个应用可能需要各自拥有一套“独立”的Python运行环境,我们可以使用virtualenv解决这个问题,它可以为一个应用创建一套“隔离”的Python运行环境。
https://www.cnblogs.com/ssooking/p/6155025.html
二 pycharm与nosetests
https://www.cnblogs.com/shengulong/p/6689329.html
三 实战——单元测试骨架建立
1 目录结构
2 setup.py
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'My Project',
'author': 'My Name',
'url': 'URL to get it at.',
'download_url': 'Where to download it.',
'author_email': 'My email.',
'version': '0.1',
'install_requires': ['nose'],
'packages': ['NAME'],
'scripts': [],
'name': 'projectname'
}
setup(**config)
3 Name_test.py
from nose.tools import *
import Name
def setup():
print ("SETUP!")
def teardown():
print ("TEAR DOWN!")
def test_basic():
print ("I RAN!")
4 测试结果
E:\Python\exercise\projects\skeleton>nosetests
.
----------------------------------------------------------------------
Ran 1 test in 0.011s
OK