Re: [openstack-dev] addCleanup vs. tearDown

2013-10-09 Thread Lingxian Kong
+1. Thanks Monty, very good clarification and suggestion!


2013/10/9 Nachi Ueno na...@ntti3.com

 +1

 2013/10/8 Monty Taylor mord...@inaugust.com:
  Hey!
 
  Got a question on IRC which seemed fair game for a quick mailing list
 post:
 
  Q: I see both addCleanup and tearDown in nova's test suite - which one
  should I use for new code?
 
  A: addCleanup
 
  All new code should 100% of the time use addCleanup and not tearDown -
  this is because addCleanups are all guaranteed to run, even if one of
  them fails, whereas a failure inside of a tearDown can leave the rest of
  the tearDown un-executed, which can leave stale state laying around.
 
  Eventually, as we get to it, tearDown should be 100% erradicated from
  OpenStack. However, we don't really need more patch churn, so I
  recommend only working on it as you happen to be in related code.
 
  Thanks!
  Monty
 
  ___
  OpenStack-dev mailing list
  OpenStack-dev@lists.openstack.org
  http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev




-- 
**
*Lingxian Kong*
Huawei Technologies Co.,LTD.
IT Product Line CloudOS PDU
China, Xi'an
Mobile: +86-18602962792
Email: konglingx...@huawei.com; anlin.k...@gmail.com
___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] addCleanup vs. tearDown

2013-10-08 Thread Nachi Ueno
+1

2013/10/8 Monty Taylor mord...@inaugust.com:
 Hey!

 Got a question on IRC which seemed fair game for a quick mailing list post:

 Q: I see both addCleanup and tearDown in nova's test suite - which one
 should I use for new code?

 A: addCleanup

 All new code should 100% of the time use addCleanup and not tearDown -
 this is because addCleanups are all guaranteed to run, even if one of
 them fails, whereas a failure inside of a tearDown can leave the rest of
 the tearDown un-executed, which can leave stale state laying around.

 Eventually, as we get to it, tearDown should be 100% erradicated from
 OpenStack. However, we don't really need more patch churn, so I
 recommend only working on it as you happen to be in related code.

 Thanks!
 Monty

 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


[openstack-dev] addCleanup vs. tearDown

2013-10-08 Thread Monty Taylor
Hey!

Got a question on IRC which seemed fair game for a quick mailing list post:

Q: I see both addCleanup and tearDown in nova's test suite - which one
should I use for new code?

A: addCleanup

All new code should 100% of the time use addCleanup and not tearDown -
this is because addCleanups are all guaranteed to run, even if one of
them fails, whereas a failure inside of a tearDown can leave the rest of
the tearDown un-executed, which can leave stale state laying around.

Eventually, as we get to it, tearDown should be 100% erradicated from
OpenStack. However, we don't really need more patch churn, so I
recommend only working on it as you happen to be in related code.

Thanks!
Monty

___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev