我应该如何表明尚未在Python中编写测试?

Way*_*ner 5 python tdd unit-testing

我正在使用Python和unittest模块进行TDD .在NUnit中你可以Assert.Inconclusive("This test hasn't been written yet").

到目前为止,我还没有在Python中找到类似的东西来表示"这些测试只是占位符,我需要回来并实际将代码放入其中."

这是否有Pythonic模式?

Mar*_*ers 11

使用新的和更新的unittest模块,您可以跳过测试:

@skip("skip this test")
def testSomething(self):
    pass # TODO

def testBar(self):
    self.skipTest('We need a test here, really')

def testFoo(self):
    raise SkipTest('TODO: Write a test here too')
Run Code Online (Sandbox Code Playgroud)

当测试运行器运行这些时,它们被单独计数("跳过:(n)").