【发布时间】:2020-04-28 01:28:19
【问题描述】:
我正在使用 pytest,我想用标记来标记我的测试,这些标记将指定在我的驱动程序中加载哪个页面的夹具。这很容易与行为上下文对象一起使用,但我找不到如何使用 pytest。
以这段代码为例
import pytest
@pytest.fixture
def text(request):
if 'hello' in X:
return 'found it!'
return 'did not find it :('
@pytest.mark.hello
def test_hello(text):
assert text == 'found it!'
X 应该是什么才能通过这个测试?
我试过request.node.own_markers,但这只是给了我一个空列表,即使我标记了测试。
【问题讨论】: