【发布时间】:2023-03-13 21:40:01
【问题描述】:
我有一个带有一些静态方法和普通方法的测试类。问题是pytest 没有收集静态方法。我在文档中找不到与此相关的任何内容。我怎样才能让它也收集静态方法?
class TestFoo(object):
@staticmethod
def test_bar():
assert 1 == 1
def test_bar2(self):
assert 1 == 1
在上面的类中,只收集了test_bar2 而test_bar() 没有。
我正在运行Python 2.7.13, pytest-3.1.2, py-1.4.34, pluggy-0.4.0
插件是xdist-1.17.1, leaks-0.2.2, cov-2.5.1
【问题讨论】:
标签: python static-methods pytest