I'm doing TDD using Python and the unittest
module. In NUnit you can Assert.Inconclusive("This test hasn't been written yet")
.
So far I haven't been able to find anything similar in Python to indicate that "These tests are just placeholders, I need to come back and actually put the code in them."
Is there a Pythonic pattern for this?
With the new and updated unittest module you can skip tests:
@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')
When the test runner runs these, they are counted separately ("skipped: (n)").
I would not let them pass or show OK, because you will not find them easily back.
Maybe just let them fail and the reason (not written yet), which seems logical because you have a test that is not finished.
I often use self.fail as a todo list
def test_some_edge_case(self):
self.fail('Need to check for wibbles')
Works well for me when I'm doing tdd.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With