assertions in setUp are fine IMO. But here's the thing. WHat should this code do?
class Demo(unittest.TestCase):
def setUp(self):
raise Exception('hi')
def test_normal(self):
# this should NOT be covered by expectedFailure
pass
@unittest.expectedFailure
def test_expected_fail(self):
pass
This will fail today because the decorator doesn't affect setUp.
If we apply a patch to change this, it will fail because test_normal doesn't apply the decorator.
I can imagine with dependency injection that one could set this up and have it genuinely configured correctly: but if one is doing that I'd expect the dimension of variance to be per scenario, not per test method. So it still wouldn't make sense to me.
@nick - yes, thats exactly right, this is at most docs IMO. |