1 Star 0 Fork 0

孙晓雪 / TextBlob

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
run_tests.py 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
Steven Loria 提交于 2017-12-02 17:06 . Run flake when running tests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
The main test runner script.
Usage: ::
python run_tests.py
Skip slow tests
python run_tests.py fast
When there's no Internet
python run_tests.py no-internet
'''
from __future__ import unicode_literals
import subprocess
import sys
import nose
from textblob.compat import PY2
PY26 = PY2 and int(sys.version_info[1]) < 7
PYPY = "PyPy" in sys.version
def main():
args = get_argv()
retcode = subprocess.call(['flake8', 'textblob'])
if retcode:
sys.exit(1)
success = nose.run(argv=args)
sys.exit(0) if success else sys.exit(1)
def get_argv():
args = [sys.argv[0], "tests", '--verbosity', '2']
attr_conditions = [] # Use nose's attribselect plugin to filter tests
if "force-all" in sys.argv:
# Don't exclude any tests
return args
if "cover" in sys.argv:
args += ["--with-coverage", "--cover-html"]
try:
__import__('numpy')
except ImportError:
# Exclude tests that require numpy
attr_conditions.append("not requires_numpy")
if not PY2:
# Exclude tests that only work on python2
attr_conditions.append("not py2_only")
if PYPY:
# Exclude tests that don't work on PyPY
attr_conditions.append("not no_pypy")
if "fast" in sys.argv:
attr_conditions.append("not slow")
if "no-internet" in sys.argv:
# Exclude tests that require internet
attr_conditions.append("not requires_internet")
# Skip tests with the "skip" attribute
attr_conditions.append("not skip")
attr_expression = " and ".join(attr_conditions)
if attr_expression:
args.extend(["-A", attr_expression])
return args
if __name__ == '__main__':
main()
1
https://gitee.com/sunxiaoxue113/TextBlob.git
git@gitee.com:sunxiaoxue113/TextBlob.git
sunxiaoxue113
TextBlob
TextBlob
master

搜索帮助