我使用pytest并执行下一个测试,我必须将一个变量(product_id)传递给它们,例如:
def test_1():
product = Product()
product.enter_name('product1')
product.add_price(2)
product.add()
product_id = driver.find_element_by_name('id')
def test_2():
driver.get('http://example.com/{}'.format(product_id)
...
我该怎么做?