← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1480119] Re: Replace tearDown with addCleanup in unit tests

 

** Changed in: keystone
       Status: Fix Committed => Fix Released

** Changed in: keystone
    Milestone: None => liberty-3

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Keystone.
https://bugs.launchpad.net/bugs/1480119

Title:
  Replace tearDown with addCleanup in unit tests

Status in Keystone:
  Fix Released

Bug description:
  tearDown should be replace by addCleanup  in the unit tests to avoid
  stale state if setUp fails or any failure in tearDown method.

  There is a bp in cinder project, just copy them here for reference,
  "Infra team has indicated that tearDown methods should be replaced with addCleanup in unit tests.
  The reason is that all addCleanup methods will be executed even if one of them fails, while a failure in tearDown method can leave the rest of the tearDown un-executed, which can leave stale state laying around.

  Moreover, tearDown methods won't run if an exception raises in setUp
  method, while addCleanup will run in such case.

  So, we should replace tearDown with addCleanup methods."

  Since the tearDown method is not used widely in keystone sub-project,
  so just file a bug to track the change."

  The link of the reference:
  https://blueprints.launchpad.net/cinder/+spec/replace-teardown-with-
  addcleanup

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1480119/+subscriptions


References