19、测试驱动开发:nose、py.test、Fakes、Mocks与文档驱动开发
2026/6/10 4:33:05 网站建设 项目流程

测试驱动开发:nose、py.test、Fakes、Mocks与文档驱动开发

1. nose测试工具

1.1 安装

nose是一个具有强大发现功能的测试运行器,可使用easy_install进行安装:

$ easy_install nose

安装过程中会搜索相关资源并处理依赖:

Searching for nose Reading http://pypi.python.org/simple/nose/ Reading http://somethingaboutorange.com/mrl/projects/nose/ ... Processing dependencies for nose Finished processing dependencies for nose

1.2 测试运行

安装完成后,会出现nosetests命令,可直接使用该命令运行测试。例如:

$ nosetests -v test_average (test_utils.MyTests) ... ok test_another_test (test_utils.MyTests2) ... ok builds the test suite. ... ok ---------------------------------

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询