PyTest没有运行任何测试,也不清楚为什么.我试图使用--debug但没有得到任何有价值的信息.目前尚不清楚如何使用pytest调试此类问题(看起来像PyTest配置/ env变量/测试名称模式有些问题?)
测试文件示例:
$ cat test_sanity.py
import pytest
@pytest.mark.sanity
def test_me():
""" I'm a test. """
assert True
Run Code Online (Sandbox Code Playgroud)
但是PyTest没有运行任何测试:
$ pytest
================================================== test session starts ===================================================
platform linux2 -- Python 2.7.12, pytest-3.1.3, py-1.4.34, pluggy-0.4.0
rootdir: /home/qawizard/pytest-hell, inifile:
plugins: xdist-1.15.0, timeout-1.2.0
collected 1 item s
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Exit: Done! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================== no tests ran in 0.13 seconds ==============================================
Run Code Online (Sandbox Code Playgroud)
为什么这样?
假设我有test_case1.pyin 文件夹A和test_case2.pyin 文件夹B。我可以使用单个pytest命令一起运行它们吗?
文件夹结构:
projectfolder/A/test_case1.py
projectfolder/B/test_case2.py
Run Code Online (Sandbox Code Playgroud)