跟我學python(6)----nosetests指令碼學習
大致網路上看了一下, 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.
這一段英文基本看不懂,自己搜尋查吧, 計算機有一些特別的術語。