def test(args='', py=None):
'''Run unit tests.
Keyword-Args:
args: Optional arguments passed to pytest
py: python version to run the tests against
Example:
fab test:args=-s,py=py27
'''
basedir = dirname(__file__)
if py is None:
# e.g. envlist: 'envlist = py26,py27,py33,py34,py35,py36'
envlist = local(flo('cd {basedir} && grep envlist tox.ini'),
capture=True)
_, py = envlist.rsplit(',', 1)
with warn_only():
res = local(flo('cd {basedir} && '
"PYTHONPATH='.' .tox/{py}/bin/python -m pytest {args}"))
print(res)
if res.return_code == 127:
print(cyan('missing tox virtualenv, '
'run fabric task `tox`:\n\n '
'fab tox\n'))
sys.exit(1)
评论列表
文章目录