assert statement should be removed from heat

Bug #1397883 reported by ZhiQiang Fan
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
ZhiQiang Fan

Bug Description

assert should be replaced by testtools.assert* in test code, and replaced by raising exceptions in source code

ZhiQiang Fan (aji-zqfan)
Changed in heat:
assignee: nobody → ZhiQiang Fan (aji-zqfan)
Revision history for this message
Angus Salkeld (asalkeld) wrote :

I agree with the heat/tests/ part, but think there is valid use of it in the code to catch programming error.

Changed in heat:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master

Changed in heat:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Submitter: Jenkins
Branch: master

commit 6c4bdc43d931bf38f7d9daad6fccc8c767378d5e
Author: Zhiqiang Fan <email address hidden>
Date: Mon Sep 28 02:06:54 2015 -0600

    replace assert statement with unittest.assertXXX

    There are two concerns to do this:

    * assert statement will not be executed when running under optimized
      mode (even though we don't really do this currently)
    * unittest.assertXXX provides more detailed message when test fail,
      for example, assert count == 2 will only have AssertionError, but
      unittest.assertXXX can tell you the test fail because 1 != 2

    This patch replaces assert statement with unittest.assertXXX in our
    test code.

    Note, not all assert statements are replaced because some of them are
    not aiming at the test result.

    Change-Id: Ida44bf6876e6fa60a4d8213f1cdad6edefb34cab
    Closes-Bug: #1397883

Changed in heat:
status: In Progress → Fix Committed
Changed in heat:
status: Fix Committed → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/heat

This issue was fixed in the openstack/heat development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers