【发布时间】:2020-01-30 21:17:48
【问题描述】:
我正在尝试像这样对我的班级测试进行参数化:
@pytest.mark.parametrize('current_user', ["test_profile_premium", "test_profile_free"], indirect=True)
class TestFeedItemsType:
@pytest.fixture(autouse=True)
def setup(self, current_user, logged_in_client, dummy_object):
self.client = logged_in_client
self.test_profile = current_user
self.object = dummy_object
但是,我收到了错误:
找不到夹具“当前用户”
test_profile_premium 和 test_profile_free 都是 conftest.py 中现有的有效装置。我需要这个基于类的套件中的所有函数(测试)来针对test_profile_premium 和test_profile_free 运行。
【问题讨论】:
标签: python pytest pytest-django