我的用例是仅在满足特定条件时调用固定装置。但由于我们需要调用 pytest 夹具作为测试函数的参数,因此每次运行测试时都会调用它。
我想做这样的事情:
@pytest.parameterize("a", [1, 2, 3]) def test_method(a): if a == 2: method_fixture
python fixtures pytest
fixtures ×1
pytest ×1
python ×1