带有 setup.py 测试的 pytest
pytest with setup.py test
我使用说明,说明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'],
)
考虑像这样使用 pytest.ini option addopts
:
# This is pytest.ini in your root directory
[pytest]
addopts = --ignore=env
setup.py test
已弃用,如 pytest-runner 存储库中所述:https://github.com/pytest-dev/pytest-runner#deprecation-notice.
推荐的方法是直接调用 python -m pytest
,就像在您的第一个命令中一样。
我使用说明,说明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'],
)
考虑像这样使用 pytest.ini option addopts
:
# This is pytest.ini in your root directory
[pytest]
addopts = --ignore=env
setup.py test
已弃用,如 pytest-runner 存储库中所述:https://github.com/pytest-dev/pytest-runner#deprecation-notice.
推荐的方法是直接调用 python -m pytest
,就像在您的第一个命令中一样。