相关疑难解决方法(0)

如果定义了构造函数,py.test将跳过测试类

我有跟随通过py.test运行的unittest代码.仅运行构造函数会在运行py.test -v -s时跳过整个类

收集0件/ 1跳过

任何人都可以向我解释py.test的这种行为吗?

我有兴趣了解py.test行为,我知道不需要构造函数.

谢谢,Zdenek

class TestClassName(object):
    def __init__(self):
       pass

    def setup_method(self, method):
       print "setup_method called"

    def teardown_method(self, method):
       print "teardown_method called"

    def test_a(self):
       print "test_a called"
       assert 1 == 1

    def test_b(self):
       print "test_b called"
       assert 1 == 1
Run Code Online (Sandbox Code Playgroud)

python pytest

43
推荐指数
2
解决办法
2万
查看次数

标签 统计

pytest ×1

python ×1