我正在使用 Python 和 unittest
模块进行 TDD。在 NUnit 中,您可以Assert.Inconclusive("This test hasn't been written")
。
到目前为止,我还没有在 Python 中找到任何类似的东西来表明“这些测试只是占位符,我需要回来并实际将代码放入其中。”
这有 Pythonic 模式吗?
最佳答案
随着new and updated unittest module你可以跳过测试:
@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')
当测试运行器运行这些时,它们被单独计算(“skipped: (n)”)。
关于python - 我应该如何指示尚未用 Python 编写测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12110610/