[tahoe-dev] [tahoe-lafs] #749: Tahoe-LAFS fails unit tests when the "-OO" flag is passed to Python to optimize and strip docstrings

tahoe-lafs trac at allmydata.org
Tue Jul 14 23:50:18 PDT 2009


#749: Tahoe-LAFS fails unit tests when the "-OO" flag is passed to Python to
optimize and strip docstrings
------------------------+---------------------------------------------------
     Reporter:  zooko   |       Owner:  somebody
         Type:  defect  |      Status:  closed  
     Priority:  major   |   Milestone:  1.5.0   
    Component:  code    |     Version:  1.4.1   
   Resolution:  fixed   |    Keywords:          
Launchpad_bug:          |  
------------------------+---------------------------------------------------
Changes (by warner):

  * status:  new => closed
  * resolution:  => fixed
  * milestone:  eventually => 1.5.0


Comment:

 I had some time, so I fixed it, in [3993]. All were cases where we
 intentionally do something wrong so as to trigger an (assertion) exception
 and then check the resulting behavior. All were fixed by replacing the
 !AssertionError with something more specific.

 The best rule to follow is probably this:

  * if an exception is worth testing, it's part of the API
  * !AssertionError should never be part of the API

 OTOH, it's a bother to create a whole new exception type and add an "if"
 clause (and then fret about whether the code-coverage stats are going to
 go down) just to do something that should be highly encouraged like adding
 preconditions and internal consistency checks. Maybe it means we're being
 overzealous in our unit tests and exercising things that we shouldn't or
 don't need to exercise.

-- 
Ticket URL: <http://allmydata.org/trac/tahoe/ticket/749#comment:2>
tahoe-lafs <http://allmydata.org>
secure decentralized file storage grid


More information about the tahoe-dev mailing list