根据 Pytest 中的“https://docs.pytest.org/en/stable/getting-started.html”,当在类内对测试进行分组时,每个测试都有该类的唯一实例。让每个测试共享相同的类实例对于测试隔离非常不利,并且会导致不良的测试实践。这意味着什么?概述如下:test_class_demo 的内容。
class TestClassDemoInstance:
def test_one(self):
assert 0
def test_two(self):
assert 0
Run Code Online (Sandbox Code Playgroud)