【问题标题】:pytest with setup.py testpytest 与 setup.py 测试
【发布时间】:2016-04-03 21:01:36
【问题描述】:

我使用说明,描述了here

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

py.test --ignore=env

但是如果我使用

python setup.py test

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

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

谢谢!

更新

setup.py:

from setuptools import setup, find_packages

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

【问题讨论】:

标签: python pytest


【解决方案1】:

考虑像这样使用pytest.ini option addopts

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

【讨论】:

    【解决方案2】:

    setup.py test 已被弃用,如 pytest-runner 存储库中所述:https://github.com/pytest-dev/pytest-runner#deprecation-notice

    推荐的方法是直接调用python -m pytest,就像在您的第一个命令中一样。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多