标签:color Fix red 需要 isa col test xtu make
如果fixture中需要入参时,不是直接返回数据,而是返回生成数据的函数。然后可以在测试用例中调用此函数。
@pytest.fixture def make_customer_record(): def _make_customer_record(name): return {"name": name, "orders": []} return _make_customer_record def test_customer_records(make_customer_record): customer_1 = make_customer_record("Lisa") customer_2 = make_customer_record("Mike") customer_3 = make_customer_record("Meredith")
标签:color Fix red 需要 isa col test xtu make
原文地址:https://www.cnblogs.com/gcgc/p/12744369.html