相关疑难解决方法(0)

PyTest不会运行任何测试

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)

为什么这样?

python pytest

6
推荐指数
1
解决办法
3130
查看次数

有没有办法从多个文件夹运行所有 pytest 用例?

假设我有test_case1.pyin 文件夹Atest_case2.pyin 文件夹B。我可以使用单个pytest命令一起运行它们吗?

文件夹结构:

projectfolder/A/test_case1.py
projectfolder/B/test_case2.py
Run Code Online (Sandbox Code Playgroud)

python testing unit-testing pytest

5
推荐指数
1
解决办法
5925
查看次数

标签 统计

pytest ×2

python ×2

testing ×1

unit-testing ×1