Opened 12 years ago

Closed 5 years ago

#1706 defect closed duplicate (duplicate)

Make todo a decorator

Reported by: Jonathan Lange Owned by:
Priority: normal Milestone:
Component: trial Keywords:
Cc: Jean-Paul Calderone, robertc Branch:

Description (last modified by Jean-Paul Calderone)

def todo(f):
  return self.assertRaises(AssertionError, f)

def test_foo(self):
  self.assertEqual('apple', 'orange')

Change History (10)

comment:1 Changed 12 years ago by Glyph

Cc: exarkun@… added

I don't think this is a particularly good idea, but I will CC JP since he tends to have stronger opinions about this sort of thing.

comment:2 Changed 12 years ago by Jean-Paul Calderone

Description: modified (diff)

comment:3 Changed 12 years ago by Jean-Paul Calderone

There's already an API for writing TODO'd tests. Why do we need a new, different one?

comment:4 Changed 12 years ago by Jean-Paul Calderone

Cc: Jean-Paul Calderone added; exarkun@… removed

comment:5 Changed 11 years ago by Jonathan Lange

Because I dislike the old one. :)

I think it would remove a bunch of special-case code. In any case, I might change the implementation to use decorators even if the API remains unchanged.

comment:6 Changed 11 years ago by Jean-Paul Calderone

Note one problem with this style is already visible with the suppress helper function. If you import suppress into a test module, trial takes it to be a suppression definition and explodes (since it is actually a function). If todo becomes a decorator, care should be taken to avoid a similar problem.

comment:7 Changed 8 years ago by Jean-Paul Calderone

These days, I really dislike trial's todo feature. You shouldn't have todo'd tests, as far as I can tell. You should have open issues in your issue tracker.

comment:8 Changed 8 years ago by Jonathan Lange

I certainly don't like it. FWIW, recent Pythons have an expected failure mechanism in unittest.

comment:9 Changed 7 years ago by <automation>

Owner: Jonathan Lange deleted

comment:10 Changed 5 years ago by Julian Berman

Resolution: duplicate
Status: newclosed

Going to be bold and close this in favor of #6345 which we can implement to get the aforementioned unittest decorator compatible with Trial.

Note: See TracTickets for help on using tickets.