demo1用例
import pytest
import yaml
class TestDemo1:
@pytest.mark.dependency(name="demo1")
@pytest.mark.test
def test_demo(self):
print("demo1111111111")
with open("demo.yaml","w") as fo:
content = "123"
yaml.dump(content,fo)
demo2用例
import pytest
import yaml
class TestDemo2:
@pytest.mark.dependency(name="demo2", depends=["demo1"])
@pytest.mark.parametrize("demo",yaml.safe_load(open("./demo.yaml")))
@pytest.mark.test
def test_demo(self, demo):
print("demo2222222222222222")
print(demo)
两个用例一起执行pytest -s -m test
会报错,怎样可以对demo2用例做参数化?