小编Luc*_*234的帖子

如何在 Pytest 中组织类中的测试?

根据 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)

python selenium pytest

1
推荐指数
1
解决办法
3139
查看次数

标签 统计

pytest ×1

python ×1

selenium ×1