pytest 与 setup.py 测试 [英] pytest with setup.py test

查看:111
本文介绍了pytest 与 setup.py 测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用说明,描述了 这里

为了测试,我使用这个命令:

For test I use this command:

py.test --ignore=env

但是如果我使用

python setup.py test

pytest 运行所有测试(环境中的 +).

pytest runs all test (+ in env).

如何跳过env目录中的测试?

How to skip test in env dir?

谢谢!

更新

setup.py:

from setuptools import setup, find_packages

setup(
    packages=find_packages(),
    setup_requires=['pytest-runner'],
    tests_require=['pytest'],
)

推荐答案

考虑使用 pytest.ini 选项 addopts 像这样:

Consider using the pytest.ini option addopts like this:

# This is pytest.ini in your root directory
[pytest]
addopts = --ignore=env

这篇关于pytest 与 setup.py 测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆