@pytest.mark.usefixtures 装饰器用于在类或模块级别应用夹具。
import pytest
@pytest.fixture
def setup():
print("\nSetup")
@pytest.mark.usefixtures("setup")
class TestClass:
def test_method_1(self):
assert True
def test_method_2(self):
assert True
No comments yet.