assert statement should be removed from heat

Bug #1397883 reported by ZhiQiang Fan on 2014-12-01
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Low
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) on 2014-12-01
Changed in heat:
assignee: nobody → ZhiQiang Fan (aji-zqfan)
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

Fix proposed to branch: master
Review: https://review.openstack.org/228348

Changed in heat:
status: Triaged → In Progress

Reviewed: https://review.openstack.org/228348
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=6c4bdc43d931bf38f7d9daad6fccc8c767378d5e
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

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

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

Other bug subscribers