← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1226374] Re: misused assertTrue in unit tests

 

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

** Changed in: ironic
    Milestone: None => icehouse-1

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

Title:
   misused assertTrue in unit tests

Status in OpenStack Image Registry and Delivery Service (Glance):
  Fix Released
Status in Orchestration API (Heat):
  Fix Released
Status in Ironic (Bare Metal Provisioning):
  Fix Released
Status in OpenStack Identity (Keystone):
  Fix Released
Status in Oslo - a Library of Common OpenStack Code:
  Fix Released
Status in Python client library for Keystone:
  Fix Released
Status in OpenStack Object Storage (Swift):
  Fix Released
Status in Tempest:
  Fix Committed

Bug description:
  1)signature for  assertTure:
      def failUnless(self, expr, msg=None):
          """Fail the test unless the expression is true."""
          if not expr: raise self.failureException, msg
       ....................................
  assert_ = assertTrue = failUnless

  2) signature for assertEqual:    
      def failUnlessEqual(self, first, second, msg=None):
          """Fail if the two objects are unequal as determined by the '=='
             operator.
          """
          if not first == second:
              raise self.failureException, \
                    (msg or '%r != %r' % (first, second))
            ...........................
        assertEqual = assertEquals = failUnlessEqual

  assertTrue used to evaluate  one expression
  assertEqual used to compare two  expressions

  If passed two expressions to assertTrue  , it always evaluate first
  expression . That 's not expected .

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