码迷,mamicode.com
首页 > 其他好文 > 详细

unittest的命令窗口

时间:2019-10-29 21:50:48      阅读:108      评论:0      收藏:0      [点我收藏+]

标签:top   mic   http   put   start   png   als   option   info   

命令窗口执行:

  1.可以在命令窗口下执行单个module、class、method

  python -m unittest test_module1 test_module2  

  python -m unittest test_module.TestClass 

  python -m unittest test_module.TestClass.test_method

 

  2.执行某个文件下的测试用例

  python -m unittest tests/test_something.py

  3.传递-v使测试执行更加清晰

  python -m unittest -v test_module

   技术图片

  4.不传递任何测试脚本,则执行当前目录下所有能发现的脚本

  python -m unittest
  5.命令窗口语法查看
python -m unittest -h
 

optional arguments:

  -h, --help            show this help message and exit

  -v, --verbose         Verbose output

  -q, --quiet           Quiet output

  --locals              Show local variables in tracebacks

  -f, --failfast        Stop on first fail or error

  -c, --catch           Catch Ctrl-C and display results so far

  -b, --buffer          Buffer stdout and stderr during tests

  -s START, --start-directory START

                        Directory to start discovery (‘.‘ default)

  -p PATTERN, --pattern PATTERN

                        Pattern to match tests (‘test*.py‘ default)

  -t TOP, --top-level-directory TOP

                        Top level directory of project (defaults to start

                        directory)

 

 
 

 

 

 

 

 

 

unittest的命令窗口

标签:top   mic   http   put   start   png   als   option   info   

原文地址:https://www.cnblogs.com/qixc/p/11761297.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!