跟我学python(6)----nosetests脚本学习

来源:互联网 发布:调节阀计算软件 编辑:程序博客网 时间:2024/06/06 14:05

大致网络上看了一下, nose的教程,基本都比较没有看懂,还是自己翻译一下原稿吧, 想做一个优秀的程序员, 真的也许要懂不少东西。

疑问:
1、什么是cfg文件?

fg文件怎么打开,CFG文件格式一般是“cofig”的缩写,多数下情下是某些配置文件,保存了某些程序的用户设备,如注册表,日志文件,系统参数,软件配置等,

2、 什么是prefix removed?

Basic usage

Use the nosetests script (after installation by setuptools):

nosetests [options] [(optional) test files or directories

基本的用法

使用nosetests 脚本 (在安装setuptools安装之后,依赖setuptools)
nosetests [参数] 文件名或目录

In addition to passing command-line options, you may also put configuration options in a .noserc or nose.cfg file in your home directory. These are standard .ini-style config files. Put your nosetests configuration in a [nosetests] section, with the – prefix removed:

除了使用命令行参数,你可能需要在你的主目录用.noser或者nose.cfg进行配置参数。
有一些标准的ini-style配置文件,
把你的nosetests配置放在一个nosetests 中,配合prefix removed:。

[nosetests]
verbosity=3
with-doctest=1
(以上的都看不懂, 留着疑问吧)

There is also possiblity to disable configuration files loading (might be useful when runnig i.e. tox and you don’t want your global nose config file to be used by tox).
In order to ignore those configuration files simply set an environment variable >NOSE_IGNORE_CONFIG_FILES.

这一段的意思

There are several other ways to use the nose test runner besides the nosetests script. You may use nose in a test script:

有其他的一些办法 除了nosetests 脚本运用noes test runner.

import nose
nose.main()
If you don’t want the test script to exit with 0 on success and 1 on failure (like unittest.main), use nose.run() instead:

如果你不想运行test 脚本,退出0 表示成功,1表示失败,用nose.run()代替。

import nose
result = nose.run()
result will be true if the test run succeeded, or false if any test failed or raised an uncaught exception. Lastly, you can run nose.core directly, which will run nose.main():

python /path/to/nose/core.py
Please see the usage message for the nosetests script for information about how to control which tests nose runs, which plugins are loaded, and the test output.
这一段英文基本看不懂,自己搜索查吧, 计算机有一些特别的术语。

0 0