Open Draymonders opened 4 years ago
-s参数是为了显示用例的打印信息, -q参数只显示结果,不显示过程。
-s
-q
class Test_fixture: @pytest.fixture(scope="function", name="begin") def test_begin(self): print("begin") a = 1 yield 1 print("end") @pytest.fixture(scope="class", name="begin2") def test_begin2(self): print("begin2") yield print("end2") @pytest.mark.usefixtures("begin", "begin2") def test_process(self, begin): print("process") print("begin return: {}".format(begin)) @pytest.mark.usefixtures("begin2") def test_process2(self, begin2): print("process2") assert 1 == 2 """ begin2 begin process begin return: 1 end process2 end2 """
reference
pytest用例规则
-s
参数是为了显示用例的打印信息,-q
参数只显示结果,不显示过程。setup / teardown
fixture scope
fixture实现setup/teardown