基本运行
nosetests [options] [(optional) test files or directories]
import nose
nose.main()
选择用例
选项
-m=REGEX, --match=REGEX, --testmatch=REGEX
Files, directories, function names, and class names that match this regular expression are considered tests.
Default: (?:^|[b_./-])[Tt]est
-I=REGEX, --ignore-files=REGEX
Completely ignore any file that matches this regular expression. Takes precedence over any other settings or plugins. Specifying this option will replace the default setting. Specify this option multiple times to add more regular expressions
--debug-log=FILE
Log debug messages to this file (default: sys.stderr)
-a=ATTR, --attr=ATTR
Run only tests that have attributes specified by ATTR
-s, --nocapture
Don’t capture stdout (any stdout output will be printed immediately)
--with-coverage
Enable plugin Coverage: Activate a coverage report using Ned Batchelder’s coverage module.
--no-skip
Disable special handling of SkipTest exceptions.
--failed
Run the tests that failed in the last test run.
--collect-only
Enable collect-only: Collect and output test names only, don’t run any tests.