skipping one unittest assertion?

Ben Finney ben+python at benfinney.id.au
Sun May 1 10:31:35 EDT 2011


Roy Smith <roy at panix.com> writes:

> There's one particular assertion in a test method which depends on 
> production code that hasn't been written yet.  I could factor that out 
> into its own test methods and @skip that, but it would be cleaner to be 
> able to mark the particular assertion.

I think that's backward. If there are multiple conditions to assert,
then it's much cleaner to put them in distinct test case methods.

Each test case should be testing one thing: if it fails, it should be
for exactly one reason.

-- 
 \     “When people believe that they have absolute knowledge, with no |
  `\     test in reality, this [the Auschwitz crematorium] is how they |
_o__)             behave.” —Jacob Bronowski, _The Ascent of Man_, 1973 |
Ben Finney



More information about the Python-list mailing list