简介
使用DevStack部署的OpenStack环境,默认会在每个项目的目录下,生成一个run_tests.sh的shell脚本测试文件。主要用于代码二次开发 后,进行pep8代码风格测试和debug调试。不过,我几乎没用过。
其主要用途如下所示:
function usage { echo "Usage: $0 [OPTION]..." echo "Run Nova's test suite(s)" echo "" echo " -V, --virtual-env Always use virtualenv. Install automatically if not present" echo " -N, --no-virtual-env Don't use virtualenv. Run tests in local environment" echo " -s, --no-site-packages Isolate the virtualenv from the global Python environment" echo " -f, --force Force a clean re-build of the virtual environment. Useful when dependencies have been added." echo " -u, --update Update the virtual environment with any newer package versions" echo " -p, --pep8 Just run PEP8 and HACKING compliance check" echo " -8, --pep8-only-changed Just run PEP8 and HACKING compliance check on files changed since HEAD~1" echo " -P, --no-pep8 Don't run static code checks" echo " -c, --coverage Generate coverage report" echo " -d, --debug Run tests with testtools instead of testr. This allows you to use the debugger." echo " -h, --help Print this usage message" echo " --hide-elapsed Don't print the elapsed time for each test along with slow test list" echo " --virtual-env-path <path> Location of the virtualenv directory" echo " Default: /$(pwd)" echo " --virtual-env-name <name> Name of the virtualenv directory" echo " Default: .venv" echo " --tools-path <dir> Location of the tools directory" echo " Default: /$(pwd)"
下面是其使用资料:
http://www.rushiagr.com/blog/2014/09/05/openstack-unit-testing-nuggets/